How to make an x64 application connect to a 32bit ODBC driver?

Asked

Viewed 1,009 times

1

I have an x64 application written in C# with .Net Framework 4 you need to connect to the Microsoft ODBC for Oracle driver.

When using this driver with the application in x86 mode, this connection usually works. But when using the application in x64 mode it cannot connect and presents the following error:

ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

I would like to know a way my x64 app can open a connection OdbcConnection using this driver.

Obs: I need to connect to this driver so I don’t need to use the TNS file configuration inside the client.

  • I think the only way is to make your application run in 32 bits. This would be a problem for you?

  • @bigown It would be. Is there any other possibility? Or you would know how I can make a connection to Oracle 11g without the need of TNS file configuration?

  • Immediately I see no other solution but if you find something, I put.

  • @bigown as you are not sure of the solution, could give a vote to the question? So it goes into evidence so that other users can also help. thanks

  • I think psNytrancez asks this question because he has a computer in 32bits, with the database, and as the new computer are in 64, the 32 does not work but... I have a friend in France who has the same problem. After much research... it does not seem to have a 'perfect' solution. Here is an answer and there are several others about the same problem : https://community.oracle.com/thread/3577044

  • @Peter What happens is this: There is an odbc driver called "Microsoft ODBC for Oracle" (MDAC) in which it only exists in the 32bit version. My application runs in x64 mode, before that it does not see the mentioned driver. I wonder if it is possible for the x64 application to see this x86 driver cited earlier.

  • I know that it exists only in 32 bits. Unfortunately. I will get the answer from my friend Frances, but I think there is no solution.. I found a strange point: - A v. 32 bits of Odbcad32.exe is in %systemdrive% Windows Syswow64. -A v. 64 bits of Odbcad32.exe is in the folder %systemdrive% Windows System32. Which means you have the 2 ???????!!!!

  • @Peter these paths that you quoted is only to access the Data Source Administrator ODBC 32bits and 64bits. It escapes some of the question itself.

  • It is possible to put a code of how the connection is performed in the body of the question?

  • @Ciganomorrisonmendez this question is old, I managed to solve by other ways, nor in the project I am more, but I could not realize this type of connection. Anyway... it was a: Odbcconnection Connection = new Odbcconnection(odbcConnectString)

Show 5 more comments

1 answer

1

For access to a database any application must use a customer, OS or database provider. So if your application runs in 64 bits the client must be 64 bits too.

The solution is to install the 64-bit Oracle driver.

[EDIT]
It seems that there is a way for you to distribute an Oracle client, together with your application. See this link Oracle Instant Client. There are some restrictions. The size of the module reaches 120 Mb and a package should be distributed for each platform 32/64 bits.

  • @Isalamon I am using the driver "Microsoft ODBC for Oracle" precisely pq does not need the configuration of Oracle in the client nor the need to configure the tnsnames file. The cited driver can be found here: http://www.microsoft.com/en-us/download/details.aspx?id=5793

  • @psNytrancez, MDAC no longer exists as a distribution for Vista and higher operating systems. The driver in question is now provided by the bank creator only.

  • @Isalamon, ok. Regardless of that my question is about an x64 application accessing an x86 ODBC driver. Since today I have this driver "Microsoft ODBC for Oracle" and I can access when the application is x86.

  • 1

    @psNytrancez, 64-bit processes cannot execute 32-bit code. If absolutely necessary to use the 32-bit version, the only way I see is to create a 32-bit COM module that serves as an interface to the "Microsoft ODBC for Oracle". Register the module in COM+ and the 64 bit code can access the driver indirectly.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.