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

Exception while connecting to an Oracle database

 
Steli Niculescu
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to do a small JDBC program that works with an Oracle 10g express edition installed on my computer.
I downloaded the 10.2.0.4 driver (ojdbc14.jar) from here, and i have the
following code :


I get the exception
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
, even if the service is started.

What am i doing wrong?
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
  • you should use driver oracle.jdbc.driver.OracleDriver
  • since you are passing user name/password as arguement so no need to include same in URL

    static final String DB_URL = jdbc:oracle:thin:@localhost:1521:orcl;



  • Shailesh
     
    Steli Niculescu
    Greenhorn
    Posts: 14
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    It works now, thank you.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic