Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Delay in getting DB connection

  Asked By: Diane    Date: Mar 04    Category: Java    Views: 877
  

I have been encountering delays of about 800MS in getting connection
from my database within my web application, only recently.
I use the standard DriverManager.getConnection(url, username, password)
method to get the connection.

I was wondering, if any of you would have any suggestions or thoughts
of possible causes.

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Aidyn Smith     Answered On: Mar 04

Using connection  pooling can reduces this amount of time.
Give C3P0 a try!

 
Answer #2    Answered By: Abbad Akhtar     Answered On: Mar 04

Can you describe your problem in more detail?
Which database  server do you use? Is it on the same machine as your application  or you connect to database over network? How many open connections do you have at a time? ...

 
Answer #3    Answered By: Cais Nguyen     Answered On: Mar 04

Use a connection  pool(Most of application  server has a built-in connection pool). Then tune your connection pool so that it wouldn't need to call the DB for getting new connection during high load. If you do that, if it gives a couple of seconds to pass a connection, still is ok.
But check the times it get to run a query and pass the result for a single request and on different loads.

 
Didn't find what you were looking for? Find more on Delay in getting DB connection Or get search suggestion and latest updates.




Tagged: