• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1132
  • Last Modified:

using tnsnames.ora without ODP.NET

Hello I am able to connect to oracle using ODP.NET Method Shown below.

"User Id=user12;Password=pass12;Data Source=(DESCRIPTION=" +
                    "(ADDRESS=(PROTOCOL=TCP)(HOST=hoscan12)(PORT=1526))" +
                    "(CONNECT_DATA=(SID=set12)));";

But unable to connect using below.

"Data Source=set12.WORLD;Persist Security Info=True;" +
                    "User ID=user12;Password=pass12;";

Error shown belwo.

Oracle.DataAccess.Client.OracleException ORA-12154: TNS:could not resolve the connect identifier specified    at Oracle.DataAccess.Client.OracleException

Help or advise
0
NetSri
Asked:
NetSri
  • 4
  • 4
4 Solutions
 
Rainer JeschorCommented:
Hi,

if this is the entry in your tnsnames.ora
EEORA = 
	(
		DESCRIPTION=
			(ADDRESS=(PROTOCOL=TCP)
			(HOST=hoscan12)
			(PORT=1526)
		)
		(CONNECT_DATA=(SID=set12))
	)

Open in new window


then you should be able to connect using
"Data Source=EEORA;User ID=user12;Password=pass12;"

Open in new window


Available connection string:
http://www.connectionstrings.com/oracle

HTH
Rainer
0
 
NetSriAuthor Commented:
Error Connecting Oracle Using tnsnames.oraHello Rainer,

Thanks for this , but attached image tell you error i am having.

i just replaced my connection with your string replacing id,pwd and hoststring.

"Data Source=set12.WORLD;User ID=user12;Password=pass12;"

please point in right direction. Thanks
0
 
Rainer JeschorCommented:
Could you please attach the entry of your tnsnames.ora?
What happens if you run a cmd and type
tnsping set12.WORLD
?
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
NetSriAuthor Commented:
All works from command prompt.

i can connec to oracle from my command window , fire select queries etc. using tnsnames.ora.

but if use .net it does not work.

tns entry as below

WHOUSET.WORLD =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = hoscan12)(PORT = 1526))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = set12)
    )
  )
0
 
Rainer JeschorCommented:
If this is your TNSNames entry then your connect string should be using
"Data Source=WHOUSET.WORLD;User ID=user12;Password=pass12;"
0
 
NetSriAuthor Commented:
Hello Thank you very much for the replies. I get following error

when i try with
"Data Source=WHOUSET.WORLD;User ID=user12;Password=pass12;"


Test method bcsContactCenter.Test.PersonServiceTest.ReadItemNotFoundTest threw exception:
Oracle.DataAccess.Client.OracleException: ORA-12154: TNS:could not resolve the connect identifier specified

Please help
0
 
Rainer JeschorCommented:
Hi,
do you run in  64-bit?
Please verify that you have installed BOTH Oracle components for 32 AND 64bit and that the TNSNAMES.ORA in BOTH folders have the same entry for WHOUSET.WORLD.
I could not yet figure out when the 32 bit tnsnames.ora and when the 64bit tnsnames.ora will be used - so after applying the same connection infos in both files, everything worked.

HTH
Rainer
0
 
NetSriAuthor Commented:
Thank you all
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now