Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

jdbc driver and connection refused questions

843854Jul 16 2004 — edited Jul 16 2004
I am working on a simple java program but I can't get it to connect to the database.
I am using the Sun Java IDE Enterprise edition and Sun App Server 7. When it hits the getConnection line, it says connection refused. The sid, login and password are correct. I can login fine to the Oracle Enterprise Manager with these parameters, but not using java and th drivermanager.

I tried using the OCI version of the connection parameters but that basically told me that I was using the wrong driver.

If anyone has any answers it would be greatly appreciated.

Here is the connection code.

public Connection getConnection(){

Connection con = null;

try
{

Class.forName("oracle.jdbc.driver.OracleDriver");
}
catch(ClassNotFoundException ex)
{
"System.out.println("Exception thrown " + ex);
}

try {


con = DriverManager.getConnection("jdbc:oracle:thin://localhost:81:sid", "login", "password");

}catch (SQLException e) {
System.out.println("SQL Exception : " + e);
}
return con;
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 13 2004
Added on Jul 16 2004
9 comments
399 views