| | |
Database Pooling design
Please support our JSP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
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.
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.
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
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 ?"
"How to ask questions the smart way ?"
![]() |
Similar Threads
- Set runtime connection to the Access database for Crystal report (VB.NET)
- database design advice (Database Design)
- Database and web design (MySQL)
- Database Table Design (Database Design)
- Help on General Best Practices for Table/Database Design (Database Design)
- Connecting to a SQL Server Database using VB (VB.NET)
- How do you integrate a database w/web design? best solution for online catalogue? (Database Design)
- database table design problems (Database Design)
Other Threads in the JSP Forum
- Previous Thread: JSP custom tag libraries questions and needed recommendations
- Next Thread: opening an excel file in C drive using a hyperlink in jsp
| Thread Tools | Search this Thread |
apache array backbutton combobox comma connection csv database development directorystructure dropdownlist dynamicpagetitles eclipse frames glassfish ie8 imagetodatabse imageupload integer internet java javaee javascript jsf jsp jsppagetitles levels mvc2 mvcmodel2 mysql netbeans network parameters passing ping printinserverinsteadofclient read redirect request.getparameter response seperated servlet servletdopost()readxml sessions software sql ssl state_saving_method stocks sun tomcat tutorial update values video web write






