943,949 Members | Top Members by Rank

Ad:
  • JSP Discussion Thread
  • Marked Solved
  • Views: 660
  • JSP RSS
May 22nd, 2009
0

Database Pooling design

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
webster5u is offline Offline
6 posts
since May 2009
May 23rd, 2009
1

Re: Database Pooling design

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.
Featured Poster
Reputation Points: 653
Solved Threads: 151
Nearly a Posting Virtuoso
stephen84s is offline Offline
1,316 posts
since Jul 2007
May 24th, 2009
0

Re: Database Pooling design

stephen84s, thank for you comment.
It is really useful information.
Thank a lot.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
webster5u is offline Offline
6 posts
since May 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC