I am an application developer that works on a windows forms app. Ive been developing on a machine that was windows 10 64 bit with oracle client 11g and MS Office 32 bit. My company is doing a lot of upgrades. I now have Office 64 bit. I no longer could connect with access to oracle using the 11g client, but my visual studio development worked just fine and I could connect to an oracle server. Now they are upgrading to Oracle client 12.1. There is a 64 bit an 32 bit version. If I install the 64 bit, my connection to oracle through ms access works fine, but now trying to connect in visual studio fails. So I have 32 bit oracle client installed as well. But it still doesnt work. I am not sure what to do. How can I get my dataset using my oracle connection to work again?
I can add the oracle server and see the tables in server explorer, but when i try to connect to oracle in my program, i get ORA-12154: TNS:could not resolve the connect identifier specified. My TNSNAMES.ora file is set up. How does it know which oracle to use 32 or 64 bit. I am use Oracle.ManagedDataAccess
Imports Oracle.ManagedDataAccess
Dim conn As New OracleConnection
Dim oradstr As String = EMS.My.Settings.ORAD_Conn
Dim orapstr As String = EMS.My.Settings.ORAP_Conn
constr = EMS.My.Settings.ORAD_Conn
constr = constr.Replace("{username}", Trim$(UsernameTextBox.Text))
constr = constr.Replace("{pwd}", PasswordTextBox.Text)
My.Settings.RunTimeConnectionString_ORAD = constr
conn = New OracleConnection
conn.ConnectionString = My.Settings.ORAD_Conn
conn.Open()
conn.Dispose()
conn.Close()
You mix several issues. A statement like "still doesn't work" is not very helpful without any error message.
If you like to use 32-bit and 64-bit Oracle client then follow this instruction: BadImageFormatException. This will occur when running in 64 bit mode with the 32 bit Oracle client components installed
With such installation it works in either ways.
In your code you use the ODP.NET Managed Driver. Here it does not matter if you use 32-bit or 64-bit, so the error is a different one than above.
Problem is different drivers use different path to allocate the
tnsnames.ora
file (see Determining location of relevant tnsnames.ora file).Most important difference between ODP.NET Managed Driver and many other drivers is: ODP.NET Managed Driver does not read your Registry whereas others read key
HKLM\SOFTWARE\ORACLE\KEY_{Oracle_Home_Name}\TNS_ADMIN
, resp.HKLM\SOFTWARE\Wow6432Node\ORACLE\KEY_{Oracle_Home_Name}\TNS_ADMIN
Define location of
tnsnames.ora
either by Environment VariableTNS_ADMIN
or configure it in your .NET config file. I think the simplest way is theOraProvCfg.exe
tool for this: