Problem opening a tnsname based connection (ORA-12154)...

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
rpgkaiser
Posts: 4
Joined: Tue 09 Oct 2007 13:35

Problem opening a tnsname based connection (ORA-12154)...

Post by rpgkaiser » Mon 05 Nov 2007 21:54

Hi,

I'm having problem stablishing connection with OraDirect 3.50 when using tnsname based connectionString. Specifically my connectionString is:

"Server=test_db;User Id=admin;Password=admin"

and when i try to open the connection an exception occur:

"ORA-12154: TNS:Could not resolve service name".

The strange is that with the same info i can connect perfectly using SQLPlus; and i can connect to this oracle server using direct mode, i mean, using this connectionString:

"Direct=true;Server=sal-emp-dsk-06;Port=1521;SID=orcl;User Id=admin;Password=admin"

The tnsname entry test_db is:

test_db =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = sal-emp-dsk-06)(PORT = 1521))
)
(CONNECT_DATA =
(SID = orcl)
)
)

Please i will appraise any help. I already re-install my oracle server and client softwares, and i'm still having the same problem.

PD: I have a suggestion for the web site developers... please add a search functionality for the forum pages. THANKS!!

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Tue 06 Nov 2007 08:47

You need a space in every line starting from the second:

Code: Select all

test_db = 
 (DESCRIPTION = 
 (ADDRESS_LIST = 
 (ADDRESS = (PROTOCOL = TCP)(HOST = sal-emp-dsk-06)(PORT = 1521)) 
 ) 
 (CONNECT_DATA = 
 (SID = orcl) 
 ) 
 )

rpgkaiser
Posts: 4
Joined: Tue 09 Oct 2007 13:35

Re: Problem opening a tnsname based connection (ORA-12154)...

Post by rpgkaiser » Tue 06 Nov 2007 13:18

Well, the spaces are there, seems like in the copy-paste where removed, but are there. Any way, i added more spaces in every line and the problem persist.

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Tue 06 Nov 2007 13:32

How many Oracle homes do you have? Maybe this is the problem...

rpgkaiser
Posts: 4
Joined: Tue 09 Oct 2007 13:35

Post by rpgkaiser » Tue 06 Nov 2007 13:53

I have only one Oracle Home. I am really very amazed because these problem appear form one day to other, apparently without any change, because i was working very well one day and the next day, the problem appear; and the most surprised thing is that this problem only occur with the CoreLab, because with other tools that enable connections to Oracle (SQLPlus, TOAD, etc), that use the same OCI connection elements, this problem don't occur.

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Tue 06 Nov 2007 16:00

We have never experienced such problems.
Maybe there is some obsolete parts from another client on your PC. This can be verified if you attach to your application in unmanaged mode and see what DLLs and from what paths are loaded.
Alternatively, you can work around tnsnames.ora if you set your connection string like this:

Code: Select all

Server=(DESCRIPTION =  (ADDRESS_LIST =  (ADDRESS = (PROTOCOL = TCP)(HOST = sal-emp-dsk-06)(PORT = 1521))  )  (CONNECT_DATA =  (SID = orcl)  )  )

Post Reply