Solved

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

Posted on 2008-10-20
6
3,284 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to downgrade visual studio 2015 enterprise to professional 6 128
Oracle Mulit-site configuration 28 73
Oracle Join issue. 3 47
Oracle SQL Developer equivalent MS SQL 6 34
Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

734 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