Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error ORA-12154: TNS:could not resolve the connect identifier specified

735500Nov 18 2009 — edited Nov 18 2009
I'm attempting to use a vbscript to make a connection to an Oracle 10g database. The script I am using is a known working script that I have copied from an old machine to my new machine. It still works from my old machine (Running Windows XP SP3), but when ran on my new machine (Running Windows XP SP3) I receive the following error:

"Error #-2147467259 ORA-12154: TNS:could not resolve the connect identifier specified"

On my new system I am able to successfully connect to this database using both the sqlplus gui and command line. I am also able to successfully tnsping it as well. Below I have included a copy of my script and tnsnames file. Any assistance would be greatly appreciated!

-Erik

<<<Begin Script>>>
'declare global constants
Const DatabaseServerName = "XXXX.DOMAIN.COM"
Const DatabaseUserID = "username"
Const DatabasePassword = "password"

'declare variables
Dim objConnection, strMsg

'create connection objects
Set objConnection = CreateObject("ADODB.Connection")

strConnectInfo = "Provider=MSDAORA.1;Password=" & DatabasePassword & ";User ID=" & _
DatabaseUserID & ";Data Source=" & DatabaseServerName & ";Persist Security Info=false;"


On Error Resume Next
'open connection to database
objConnection.Open strConnectInfo
If err.number<>0 Then
strMsg="Error connecting to database. Exiting script..." & VbCrLf
strMsg=strMsg & "Error #" & Err.Number & " " & Err.Description
WScript.Echo strMsg
WScript.Quit
End If
On Error GoTo 0

'close connection to database
objConnection.Close
<<<End Script>>>

<<<Begin tnsnames.ora>>>
XXXX.DOMAIN.COM =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = server.domain.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = xxxx.domain.com)
)
)
<<<End tnsnames.ora>>>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 16 2009
Added on Nov 18 2009
4 comments
1,991 views