Database Pooling design

Thread Solved

Join Date: May 2009
Posts: 6
Reputation: webster5u is an unknown quantity at this point 
Solved Threads: 0
webster5u's Avatar
webster5u webster5u is offline Offline
Newbie Poster

Database Pooling design

 
0
  #1
May 22nd, 2009
Hi, i am developing the JSP/Servlet system now. Let we discuss database pooling, how you normally do that? My developing application is open/close database object every single class instance.

My design is every time, we need access database then we invoked a database class object, execute SQL and close it. It is logically consume much of the computing process in server.

But my friend suggest that open a database object like a global database connection pooling. This object will open when user login and close when user logout. I feel this consume much memory resource to handle large amount user.

Who's what's the weakness for either design? Your recommendation is much appreciate.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 1,175
Reputation: stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light 
Solved Threads: 125
Featured Poster
stephen84s's Avatar
stephen84s stephen84s is offline Offline
Veteran Poster

Re: Database Pooling design

 
1
  #2
May 23rd, 2009
Rather than making your own why dont you just try some of the freely available Database Connection Pooling libraries.
Look here for a list of them, For my apps I normally used the DBPool library.
Alternatively if you are using Tomcat you can check this article

So if you use a standard pool of database connections, whenever you wish to query the database, just checkout a connection from the pool, fire your query, process the resultset if any and return the connection back to the pool.
So you neither will have the problem of continuously opening and closing connections nor the problem for one user occupying one DB connection for his entire session.
Also you can read the following references to know more about the importance of Connection pooling : 1,2
Last edited by stephen84s; May 23rd, 2009 at 1:40 am.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."

"How to ask questions the smart way ?"
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 6
Reputation: webster5u is an unknown quantity at this point 
Solved Threads: 0
webster5u's Avatar
webster5u webster5u is offline Offline
Newbie Poster

Re: Database Pooling design

 
0
  #3
May 24th, 2009
stephen84s, thank for you comment.
It is really useful information.
Thank a lot.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC