I'm running a VBA script I used to use when connecting to Oracle database through Excel 32-bit but now I'm using Excel 64-bit.
VBA code:
Set cn1 = New ADODB.Connection
Set rs1 = New ADODB.Recordset
cn1.ConnectionString = "Driver={Microsoft ODBC for Oracle};Server=BR1P1;Uid=BR1USER;Pwd=myPass"
cn1.Open
rs1.Open Query, cn1
When I execute "cn1.open" I get this error:
"Run-time error'-214746... [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
Then I tried to solve adding a new data source: ODBC Data Source Administrator (64-bit)> File DSN> click in Add...> from list I select: Oracle em OraClient11g_home1 ("Oracle em" means "Oracle for", my OS in in portuguese)> Next> browse to the file: "C:\Windows\System32\odbcad32.exe"> Next> Finish
Doing so system will give me the driver name: "Oracle em OracleClient11g_home1"
Afterwards it will prompt for Service Name, User Name and Password. I inform server Name according to my TNSNAMES.ORA
Back to VBA I changed the code according to the driver name:
cn1.ConnectionString = "Driver={Oracle em OracleClient11g_home1}"
Now when execute "cn1.Open" in VBA I receive this new error message:
"Run-time error'-214746... [Oracle][ODBC]ORA-12560: TNS:protocol adapter error"
My TNSNAMES.ORA file is like this:
BR1P1 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = myhost.com)(PORT = 1575))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = BR1P1)))
Well I'm just stucked on this. Please I appreciate any help on this. It's being a pain after I changed my MS Office to 64-bit version.