| Author |
Exception while connecting to an Oracle database
|
Steli Niculescu
Greenhorn
Joined: Jul 14, 2009
Posts: 14
|
|
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
Joined: Aug 13, 2004
Posts: 1076
|
|
you should use driver oracle.jdbc.driver.OracleDriversince 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
|
Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
|
 |
Steli Niculescu
Greenhorn
Joined: Jul 14, 2009
Posts: 14
|
|
|
It works now, thank you.
|
 |
 |
|
|
subject: Exception while connecting to an Oracle database
|
|
|