Hii All, I wish to implement connection pooling during my web application.please suugest how do i implement that.

I'd say you have two problems:

  • You do not know whether you'll need connection pooling or otherwise

and

  • If you discover it's needed, you do not know how you can implement it.

I'd initially focus on the assumption you don't require it, re-using connections is really a (possibly premature) optimisation.

However, in the event that you absolutely require it, then how you're doing so will rely on the character of the application-server.

  • In case your application is "in-process" with Apache, you actually don't have any option apart from one-connection-per-process (or thread)
  • In case your application is "from process", e.g. hooking up to Tomcat via mod_jk, you'll be able to do that which you like inside the application server (Tomcat) which might include pooling connections for use across multiple threads as appropriate.

Compelling causes of utilizing a new connection every time are:

  • No undesirable unwanted effects from old connection condition left by previous demands
  • You simply connect if needed - less chance of coming your database connections
  • Foreseeable performance - you are able to appraise the time taken for that request, including creating the bond

The only real compelling reason behind re-using connections may be the connection overhead time itself.

Some databases are relatively slow creating connections (Oracle) - other medication is considerably faster (MySQL). Some databases could be updated to help keep a swimming pool of threads internally that they reuse (MySQL) making hooking up even faster.

http://commons.apache.org/dbcp/

SUMMARY:You will find several Database Connection Pools already available, both within Jakarta items and elsewhere. This Commons package offers an chance to coordinate the efforts needed to produce and maintain a competent, feature-wealthy package underneath the ASF license.

While i don't possess a definitive answer (and am also searching it), i'm able to suggest the next (for any perl after sales):

  • if you work with mod_perl2, then take a look at Apache::DBI (http://search.cpan.org/~pgollucci/Apache-DBI-1.07/lib/Apache/DBI.pm). It's some disadvantages, that are on the page.
  • if you work with the perl DBI for connecting for your database, then rather than while using connect() method call, make use of the connect_cached() method call.