ORA-12154: TNS Could not resolve the connect ...

carlp22

Active member
Joined
Oct 3, 2006
Messages
31
Programming Experience
5-10
Hello All,

I have a VS 2005 VB project.
I was using Microsoft's Oracle driver (All worked), and then installed Oracle Developer Tools for Visual Studio .NET with ODAC 10.2.0.2.21.

After doing so, I received this error when trying to open a dataset in the designer.
"Failed to open a connection to the database"
"ORA-12154: TNS Could not resolve the connect identifier specified. Check the connection and try again".

Using the Oracle Net configuration assistant, I had to change my connection string to include the database.domain.com. (don't know why).

The project works, but here's the question - When I build the project using a setup and deploy project, it creates the .msi and setup.exe. When I run the setup on a client machine, it now will only run if I'm using the Oracle TNSNAMES.ORA. The client machines run sqlnet.ora.

The program WILL run if the client is using TNSNAMES.ORA - but I can't do that for a number of reasons.

Is there any hope?

Thanks for some help,
Carl
 
Not yet

Ah, cjard, we meet again! Thanks for the reply.

I did as you suggested with no success. I hope I haven't messed thing up with the Net Manager and Net Configuration Assistant.

MANY THANKS for your help,
Carl
 
More info

I have obviously changed something. When I use Oracle Explorer in Visual Studio 2005, I can't connect to my database. I get the same error - "ORA 12154 -TNS could not resolve..."

I get the same result connecting or adding a Data Connection through VS 2005 Server Explorer.

Any Ideas how to can recover from my improvements?

Thanks,
Carl
 
Another clue

When I rename SLQNet.ora to something else, so it's not recognized, and only have tnsnames.ora present, it works. That is to say, I can connect with Oracle Explorer and Server Explorer in VS 2005.

My tnsnames.ora is:

VB.NET:
# TNSNAMES.ORA Network Configuration File: C:\Oracle\Ora9i\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

Customers.Office.COM =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = uappabc2)(PORT = 1526))
    )
    (CONNECT_DATA =
      (SID = TRAC)
    )
  )

Is this of any help?

Thanks,
Carl
 
Is that the file in your 10g client folder? Where is your ORAHOME environment variable pointing? Why was it generated by the 9i client config? I copied mine over, then ran the 10g config, checked the options through and tested the connections, then saved it..

You need to determine which client is in use, though i found that copying the sqlnet.ora and tnsnames.ora were all that was needed to enable my 10g client to work properly.. Just take a check to see if any of the sqlnet spec has changed or improved in security in the move to 10g..

Finally, you do have the option of uninstalling the 9i client which will leave you sure of which one youre using!
 
Incidentally, your and my tnsnames differ slightly:

VB.NET:
# tnsnames.ora Network Configuration File: C:\oracle\product\10.2.0\client\NETWORK\ADMIN\tnsnames.ora
# Generated by Oracle configuration tools.

xyz.somename.local =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = PC057)(PORT = 1521))
    )
    (CONNECT_DATA =
      ([B]SERVICE_NAME [/B]= xyz)
    )
  )

somename.local is the DNS suffix of our LAN

When I conenct to the db, I either use XYZ or XYZ.somename.local - they work interchangeably


My sqlnet is very simple:

VB.NET:
# sqlnet.ora Network Configuration File: C:\oracle\product\10.2.0\client\NETWORK\ADMIN\sqlnet.ora
# Generated by Oracle configuration tools.

SQLNET.AUTHENTICATION_SERVICES= (NONE)

NAMES.DIRECTORY_PATH= (TNSNAMES)

NAMES.DEFAULT_DOMAIN = somename.local
 
cjard,

That sqlnet.ora file was in my 10 directory. I made some progress understanding why I had to specify the domain name.

During installation of 10, I couldn't usefully run a "test" on the connection. I kept trying different server names until this worked. Someone here told me not to test until I copied the sqlnet.ora and tnsnames.ora files over.

What is happening here is: when they want to use Oracle Enterprise Manager Console, they run a batch program that renames tnsNames.ora to something else and sqlnet.xxx to sqlnet.ora.

When they want to run "normally" they change tnsNames.ors to tnsNames.xxx and sqlnet.xxx to sqlnet.ora.

I don't think this is the way it should be done, but I don't understand enough about this yet.

Thanks for your reply,
Carl
 
Its weird.. Do you use TNSNames to connect to oracle instances?

SQLNet is for setting global things about the way the client behaves. much as you might be able to specify a deafult instance to connect to, I dont think i would use it as a way of determining connections behaviour

TNSNames is used only when the client is to operate in TNS mode for its service naming and it aliases servers and oracle instances on them


Do you have a TNS_ADMIN env variable? If so, oracle will get your tns from there and ignore the local one..

have a read of http://www.oracle-base.com/articles/misc/OracleNetworkConfiguration.php and see if you can work out what berkish way your co has deployed the client :D
 
How would I check for the "TNS_ADMIN env variable"?

Unfortunately, I had to remove Oracle 10 so I could make changes to my project and have the clients be able to run it.

I will try again in about a week because I really like the Oracle explorer in VS 2005 that you suggested.

Many Thanks,
Carl
 
I had the same problem , and worse, all the applications I used to work with oracle(Business objects, toad etc..) never again connected to the database.
I just got rid of ODAC and sticked to the good old System.Data.OracleClient and everything is back to normality.

Good luck
 
Ran into same situation.

I have 2 Oracle homes (9i and 10g) and somehow 10g was nowhere to be found in the Oracle part of the registry. I reinstalled the 10g client.

I also use EZCONNECT in sqlnet.ora
SQLNET.AUTHENTICATION_SERVICES= (NONE)

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

I was trying so many things that I don't remember what the true solution was to my problem (most likely reinstalling 10g).

Hope you have gotten past this by now.
 
I have 2 Oracle homes (9i and 10g) and somehow 10g was nowhere to be found in the Oracle part of the registry. I reinstalled the 10g client.

If you installed 9i after 10g it would have destroyed the 10g part of the registry.. they dont really coexist, and given that the client is free, youre generally advised to run a client suitable for the db in use (client version +-1 relative to db version)
 
Back
Top