Have you ever wanted to connect to a database
without dealing with Oracle's annoying reliance on the
tnsnames.ora file?
The trick is to put the tnsnames information into the ODBC connection string directly, using the Data Source=... option.
The following (untested) code is VB, but the concept should work in any language that supports ODBC:
Dim TNS_INFO As String
Dim cnxDB As New ADODB.Connection
TNS_INFO = "(DESCRIPTION=" & _
"(ADDRESS_LIST=" & _
"(ADDRESS=(PROTOCOL=TCP)" & _
"(HOST=prodtst1.sdd.hp.com)" & _
"(PORT=1521)))" & _
"(CONNECT_DATA=(SID=prod_tst)" & _
"(SERVER=DEDICATED)))"
cnxDB.ConnectionString = "Provider=OraOLEDB.Oracle;" & _
"Data Source=" & TNS_INFO & ";" & _
"user id=cressman;" & _
"password=mean2me"
Debug.Print cnxDB.ConnectionString
cnxDB.Open