Link to home
Start Free TrialLog in
Avatar of amanda333
amanda333

asked on

[Oracle][ODBC][Ora]ORA-12154: TNS:could not resolve service name

Hi I'm trying to connect to an oracle database using VBA code in EXCEL and it comes up with this error when I try to run the macro

[Oracle][ODBC][Ora]ORA-12154: TNS:could not resolve service name

I think the setting might be wrong also just in case this helps
Set cnOra = New ADODB.Connection
Set rsOra = New ADODB.Recordset

db_name = "test2"<-the actual name of the database is wxdb
UserName = "wworkstn"
Password = "change"

'Making an ODBC connection according to ADO
cnOra.Open "DSN=" + db_name + ";UID=" + UserName + ";PWD=" _
& Password + ";"
rsOra.CursorLocation = adUseServer

'Running a query
rsOra.Open "select global_name from global_name", cnOra, adOpenForwardOnly

so what settings do I need to use in the microsoft ODBC Data Source Administrator for either the user DSN or System DSN
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial