Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

connect oracle from java application

 
venkat penmatsa
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am trying to connect oracle from java application,but i am getting the following error

Exception in thread "main" java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at Connect.main(Connect.java:12)



my code is


i am using oracle 10g and also tell me what are the jar files required for connecting oracle DB now i am using ojdbc14 jar
please help me ASAP.
 
nazzy khan
Ranch Hand
Posts: 39
Android Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please check database connection using Toad or Aqua Studio. Are you able to connect successfully using them?
 
venkat penmatsa
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nazzy khan wrote:Can you please check database connection using Toad or Aqua Studio. Are you able to connect successfully using them?



Hi,

Thanks for your suggestion but i dont know about Aqua studio please tell me how to check database connection with Aqua studio.
 
nazzy khan
Ranch Hand
Posts: 39
Android Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well if you don't have Aqua Studio, you can use any other tool like Toad or even SQL Plus that comes with Oracle itself.

Idea here is to check whether are you able to connect to oracle database. If connection from Toad or SQL Plus is also not working then the problem lies at somewhere else.

If connection is fine with the same jdbc url details which you have used in your code, then we need to look code further.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic