Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1119
  • 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
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
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

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

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