jdbc driver and connection refused questions
843854Jul 16 2004 — edited Jul 16 2004I 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;
}