This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes Database connectivity taking too much time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Database connectivity taking too much time" Watch "Database connectivity taking too much time" New topic
Author

Database connectivity taking too much time

Tapas Chand
Greenhorn

Joined: Dec 29, 2009
Posts: 23
I am using jdk 1.5, oracle 9i, IBM AIX 5.3, classes12.jar
my code is like this

connection is getting established after almost 5 mins.
but when i am connection through sqlplus from commandline, connection is getting established instantly.

please help...
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 732
Hi,

Try this


Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30353
    
150

Are you closing the connection in a finally block when done with it? Maybe there is a resource leak? Also, why are you checking if connection is null? If you are trying to reuse the connection try using an open source connection pooling library to do so more effectively. (And a datasource rather than driver manager)


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
 
subject: Database connectivity taking too much time