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 DriverManager.getConnection Timout

843854Jan 14 2002 — edited May 31 2002
When trying to getConnection to an invalid host, the system will hang. So I am trying to find a way to set the Timout parameter for DriverManager.getConnection(...). I used DriverManager.setLoginTimeout(10);, but it doesn't work. The system still hangs. Here's part of my code: Any comment is appreciated. Thanks.

try {
DriverManager.setLoginTimeout(10);
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());

String connStmt = "jdbc:oracle:thin:@" + oesHost+ ":" + oesPort + ":" + oesSID;

conn = DriverManager.getConnection(connStmt, oesUser, oesPassword);
.......
} catch (SQLException e) {
throw e;
}
finally {
conn.close();
}


Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 28 2002
Added on Jan 14 2002
3 comments
519 views