Solved

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

Posted on 2008-10-20
6
3,282 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 47

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
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.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

773 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