Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Oracle JDBC - DSN Connection

 
Arun Mariappan K
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to connect the Oracle 10g with DSN connection named "asset". can you please kindly mention the syntax for that.

Currently i am using the below syntax. But i got "ORA-12505, TNS:listener does not currently know of SID given in connect descriptor"



Do i missed anything. please help me.

Thanks in advance.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You shouldn't need a DNS for Oracle. The error you see is because your tnsnames does not include an entiry for the service "asset". Note, you don't need a tnsnames entry if you include the host. Have a look at Oracle's JDBC page.




 
Arun Mariappan K
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul,

Thanks for your help.

My Requirement is to use only the DSN for the Oracle 10g connection. Initially i have used JDBC:ODBC and connects well as mentioned below,

Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("jdbcdbc:asset","uid","pwd");

But i like to connect with JDBC:ORACLE. So i need the connection syntax using DSN.

Could you please help me?

Thanks in advance.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

But i like to connect with JDBC:ORACLE. So i need the connection syntax using DSN.

Like I said, you don't need a DNS to do this. With regards to its syntax, doesn't the ODBC tool build this for you?

 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!