DataSource or ConnectionPoolDataSource for Application Server JDBC resources

Posted by Vinnie on Stack Overflow See other posts from Stack Overflow or by Vinnie
Published on 2011-06-28T13:03:28Z Indexed on 2012/03/20 11:29 UTC
Read the original article Hit count: 292

When creating JNDI JDBC connection pools in an application server, I always specified the type as javax.sql.ConnectionPoolDataSource. I never really gave it too much thought as it always seemed natural to prefer pooled connections over non-pooled.

However, in looking at some examples (specifically for Tomcat) I noticed that they specify javax.sql.DataSource. Further, it seems there are settings for maxIdle and maxWait giving the impression that these connections are pooled as well. Glassfish also allows these parameters regardless of the type of data source selected.

  • Are javax.sql.DataSource pooled in an application server (or servlet container)?
  • What (if any) advantages are there for choosing javax.sql.ConnectionPoolDataSource over javax.sql.DataSource (or vice versa)?

© Stack Overflow or respective owner

Related posts about java

Related posts about configuration