Manikandan
Manikandan

Reputation: 671

Connect Oracle DB using 64 bit Oracle Client from 32 bit process

I have application running in 32 bit mode. it tries to connect oracle DB using Oracle Client. Oracle Client is running in 64 bit.

string connectionString = @"Data Source=" + oracleDBName + ";User id=" + oracleDBUserId +";Password=" + oracleDBPwd +";";
            OracleConnection con = new OracleConnection(connectionString);
            try
            {
                con.Open();
                if (con != null)
                {
                    con.Open();
                }
                return true;
            }
            catch (OracleException)
            {
                return false;
            }

I am getting targetinvocationexception when i call

con.Open();

Reason, It is not able to load 64 bit dll since the application is running in 32 bit mode.

I cannot change the application mode. I also cannot install the 32 bit Oracle client. How to solve this problem

Thanks in Advance

Upvotes: 0

Views: 6899

Answers (1)

Michael T
Michael T

Reputation: 1038

Oracle driver for .NET "requires native" client from Oracle. (It's not Java, where thin client exists)

Try instant client, it doesn't require installation. http://www.oracle.com/technetwork/topics/winsoft-085727.html

Also, you can try ODBC .NET driver, but configure ODBC DSN to use Oracle driver from Microsoft (most windows installation has microsoft's odbc driver for oracle out of the box). Again:
1) for 32bit application you need 32bit version of ODBC
2) oracle instant client should be available in the search path

In Windows 64bit there are two versions of ODBC admin panels for 32bit and 64bit applications. To run 32b version execute C:\Windows\SysWOW64\odbcad32.exe.

Upvotes: 1

Related Questions