Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Tomcat JDBC Connection Pool

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat has introduced a Connection Pool lately, I think from version 7.25.

Is there a way to use this pool with earlier versions? i wonder if a separate jar could be downloaded. The problem is most hosting sites are not using the latest versions.
 
Saloon Keeper
Posts: 6433
158
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure what this new pool is supposed to do differently, but if you were using Tomcat's built-in DataSource, you would/could have been using connection pooling for years. And if you weren't using that, you could have used Apache DBCP in your web app, and achieved pretty much the same result.
 
Saloon Keeper
Posts: 22097
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you provide us with a link about this?

Tomcat has supported plugin connection pooling for probably a decade now. As shipped, there's a copy of the Apache DBCP pooler pre-supplied, but anyone that wants to can use alternate poolers as well. For a while, there was in fact a serious competitor to DBCP, although most people use DBCP now.
 
K Mansoor
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat 7.26 (JDBC Pool)


The JDBC Connection Pool org.apache.tomcat.jdbc.pool is a replacement or an alternative to the commons-dbcp connection pool.

So why do we need a new connection pool?

Here are a few of the reasons:

commons-dbcp is single threaded, in order to be thread safe commons-dbcp locks the entire pool, even during query validation.
commons-dbcp is slow - as the number of logical CPUs grow, the performance suffers, the above point shows that there is not support for high concurrency Even with the enormous optimizations of the synchronized statement in Java 6, commons-dbcp still suffers in speed and concurrency.
commons-dbcp is complex, over 60 classes. tomcat-jdbc-pool, core is 8 classes, hence modifications for future requirement will require much less changes. This is all you need to run the connection pool itself, the rest is gravy.
commons-dbcp uses static interfaces. This means you can't compile it with JDK 1.6, or if you run on JDK 1.6/1.7 you will get NoSuchMethodException for all the methods not implemented, even if the driver supports it.
The commons-dbcp has become fairly stagnant. Sparse updates, releases, and new feature support.
It's not worth rewriting over 60 classes, when something as a connection pool can be accomplished with as a much simpler implementation.
Tomcat jdbc pool implements a fairness option not available in commons-dbcp and still performs faster than commons-dbcp
Tomcat jdbc pool implements the ability retrieve a connection asynchronously, without adding additional threads to the library itself
Tomcat jdbc pool is a Tomcat module, it depends on Tomcat JULI, a simplified logging framework used in Tomcat.
Retrieve the underlying connection using the javax.sql.PooledConnection interface.
Starvation proof. If a pool is empty, and threads are waiting for a connection, when a connection is returned, the pool will awake the correct thread waiting. Most pools will simply starve.

 
today's feeble attempt to support the empire
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic