File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases 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
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Database connectivity taking too much time" Watch "Database connectivity taking too much time" New topic

Database connectivity taking too much time

Tapas Chand
Ranch Hand

Joined: Dec 29, 2009
Posts: 434

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: 833

Try this

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33124

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)

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Don't get me started about those stupid light bulbs.
subject: Database connectivity taking too much time
It's not a secret anymore!