When connecting to Oracle database, it is easy to encounter the problem of 32-bit and 64 bit drivers. On a 32-bit machine, everything is 32-bit, which is not complicated. But now the general win7 system is 64 bit, and 64 bit machine can install 32-bit and 64 bit driver.
If the WinForm program is used to connect to Oracle database, you can use Oracle’s own DLL, Oracle.DataAcess , you can also use Microsoft’s own System.Data.OracleClient . But the premise of using these two days is that the Oracle client driver must be installed on the machine. The driver here is divided into 32-bit and 64 bit. and Oracle.DataAcess Also divided into 32-bit and 64 bit, which must be consistent before and after the two.
Let’s talk about the recent problems. Recently, I’m working on a website project. Note that it’s not a web application, it’s just a website project, and it’s directly published to IIS. It’s just Microsoft ystem.Data.OracleClient The build mode of the project is any CPU, as shown in the figure below.
Because vs has its own Cassini server only in 32-bit mode, the programs in any CPU mode can only run in 32-bit mode. At this time, an exception running in 64 bit mode with the 32 bit Oracle client installed is reported System.Data.OracleClient The version of 32 or 64 is not right. Many changes have been made, but the reason has not been found out. Later, I understood that the 32 bit Oracle client installed here refers to the DLL, not the driver downloaded from the Oracle official website. Because at this time, only ORALCE’s 64 bit driver is installed on my machine. Now this program is 32-bit. When I connect to the 64 bit driver, this exception is reported. When I installed the 32-bit Oracle driver, this problem was solved.
I also encountered a small problem during the installation, because I have installed 64 bit driver before, and there is an Oracle app directory in the machine. At this time, we can install the 32-bit driver into the custom directory app2. In other words, 32-bit and 64 bit Oracle client drivers are installed on the machine at the same time. The program will connect to the corresponding driver according to its own x86 or x64 mode, and then connect to the Oracle database remotely. Note that the driver for installing Oracle client is the machine where the DLL is located, that is, the machine where the program runs, not the machine where the Oracle server is located. In essence, Oracle client and Oracle server transmit data on the network.