I am trying to create an Oracle connection string in Excel VBA. After lots of research, I have a working connection string:
Set Oracle_conn = New ADODB.Connection
Oracle_conn.Open "ODBC; Driver='Oracle in instantclient_19_9'; Data Source='Data Mart'; UserID=" & ID & "; Password=" & Password & ";"
However, this only works when my ODBC Data Source is a **User** DSN. When the ODBC Data Source is a **System** DSN, I end up with:
"[Oracle][ODBC][Ora]ORA-01017: invalid username/password; logon denied"
The reason I am using **System** DSN is because my code runs from a shared PC, so System DSN works for all users without each individual user needing to create a **User** DSN.
Any advice on how to tweak my code such that it will run with a **System** DSN would be greatly appreciated. Thank you.
Edit 1: System DSN connects successfully if I manually go to Data ribbon > Get Data > From Other Sources > From ODBC
Edit 2: I still haven't been able to figure out how to connect to a System DSN with VBA code. Maybe it's a bug with the ODBC driver? I realize this is a bit of an obscure question, but I'm still hopeful someone can help me connect. Thank you!
Asked by Andy
(1 rep)
Feb 15, 2023, 02:56 PM
Last activity: May 26, 2025, 11:06 PM
Last activity: May 26, 2025, 11:06 PM