Solved

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

Posted on 2008-10-20
6
3,283 Views
Last Modified: 2012-05-05
I have a 2005 MS Vision Studio and would like to retrieve some data from an Oracle table that is on an Oracle 9i database schema, but  I have Oracle 10G on my machine.  When I run the VB code, I get "ORA-12154: TNS:could not resolve the connect identifier specified" error.  How do I resolve this issue?

This is the part of the VB code:

myConnection_GLOBAL = New OleDbConnection("Provider=msdaora;Data Source=frd01;User Id=xxx;Password=xxx;")
            mySqlDataAdapter_GLOBAL = New OleDbDataAdapter("SELECT BAN, BTN, NAME from TABLE", myConnection_GLOBAL)

This is what I have in my SQLNET.ORA file:
NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)
NAMES.DEFAULT.DOMAIN = chq.aci.ameritech.com
NAME.DEFAULT_ZONE = chq.aci.ameritech.com
SQLNET.AUTHENTICATION_SERVICES= (NTS)

This is what I have in my TNSNAMES.ORA file:
FRD01 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = our server hostname)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = frd01)
    )
  )
0
Comment
Question by:scpig
6 Comments
 

Accepted Solution

by:
denverskier earned 100 total points
ID: 22762809
My first test here would be to run tnsping from a command window to ensure that you have your sqlnet set up correctly.
> tnsping frd01

If it does not come back as OK, you will need to make sure that everything in the tnsnames.ora is correct and that the tnsnames.ora file resides in the correct directory.  If all of that is still not working, you may want to try to ping the "HOST = our server hostname" server IP.

If those both come back positive, let us know.  If not, then check to make sure that the IP and the SID are correct.

Good luck.
0
 
LVL 48

Assisted Solution

by:schwertner
schwertner earned 50 total points
ID: 22765040
SQLNET.AUTHENTICATION_SERVICES= (NTS)
should be commented.

Try to see if the service is registered by the listener:

% lsnrctl services

You do not mention the version but by Oracle 10g/11g the first thing your DBA
should do is to amke static registration:

Go to the remote 10g installation where the Oracle server resides.

Backup LISTENER.ORA file!!!!!!!

In ...\network\admin open listener.ora

see

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = D:\Ora10g)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (SID_NAME = test)
      (ORACLE_HOME = D:\Ora10g)
    )
  )

Add the entry
    (SID_DESC =
      (SID_NAME = test)
      (ORACLE_HOME = D:\Ora10g)
    )
with regard to the particular Oracle Home and SID Name.

Restart the listener:
c:>lsnrctl stop
c:>lsnctl start
0
 
LVL 7

Assisted Solution

by:vishal68
vishal68 earned 100 total points
ID: 22765380
The culprit is NAMES.DEFAULT.DOMAIN = chq.aci.ameritech.com line in sqlnet.ora. This line means that Oracle will automatically add chq.aci.ameritech.com to the connect string provided by you. i.e in your case when you say Data Source=frd01, Oracle will actually look for a tnsnames.ora entry named frd01.chq.aci.ameritech.com and not a simple frd01.

Solution
either comment NAMES.DEFAULT.DOMAIN = chq.aci.ameritech.com in sqlnet.ora
or
change your tnsnames.ora entry to

FRD01.chq.aci.ameritech.com =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = our server hostname)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = frd01)
    )
  )

HTH
Vishal
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

Author Comment

by:scpig
ID: 22767645
tnsping frd01 comes back positive.
And I also commented out NAMES.DEFAULT.DOMAIN = chq.aci.ameritech.com in sqlnet.ora
but I still get the same ORA- error.
I do not have listener.ora file in my C drive.
What else could be wrong?

0
 

Assisted Solution

by:denverskier
denverskier earned 100 total points
ID: 22767811
since you can successfully tnsping the database, ensure that you can connect from a command prompt using:

>sqlplus username/password@frd01

if that works, then you can rest assured that Oracle is working properly, and you likely have something wrong in your code (sorry, I'm not a VB person).

If not, then log into the server where the database resides and follow schwertners advice from above and try again.
0
 
LVL 7

Assisted Solution

by:vishal68
vishal68 earned 100 total points
ID: 22773825
Another thing to check would be, are there multiple tnsnames.ora on your system. Search for tnsnames.ora on your client system. If there are multiple tnsnames.ora then ensure that you have made the entries in all of them.

HTH
Vishal
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question