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!

Why it takes long time to establish Database Connection ???

843854Feb 23 2004 — edited Feb 24 2004
Can any one please have a look on the following code snippet and show me which mistake I'm doing so it take long time to connect to DB(more than 5 minutes !!!!)
Thanx in advance ...
-------------------------------------------------------------

try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Class.forName("oracle.jdbc.driver.OracleDriver");
String dbString2 = "jdbc:oracle:thin:@" + "127.0.0.1" + ":" + "1521" + ":" + "nat";
aCon = DriverManager.getConnection(dbString2, "scott", "tiger");
stmt = aCon.createStatement();
System.out.println("Connection to DB Established");
}
catch (ClassNotFoundException cnfe)
{
System.out.println("Class not found:");
cnfe.printStackTrace();
}
catch (SQLException sqle)
{
System.out.println("SQL Exception: " + sqle.toString());
sqle.printStackTrace();
}

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 23 2004
Added on Feb 23 2004
3 comments
1,128 views