title: DataSource or ConnectionPoolDataSource for Application Server JDBC resources
body: <p>When creating JNDI JDBC connection pools in an application server, I always specified the type as <code>javax.sql.ConnectionPoolDataSource</code>.  I never really gave it too much thought as it always seemed natural to prefer pooled connections over non-pooled.</p>
  
  <p>However, in looking at some examples (<a href="https://sec1.woopra.com/docs/jndi-datasource-examples-howto.html#MySQL_DBCP_Example" rel="noreferrer">specifically for Tomcat</a>) I noticed that they specify <code>javax.sql.DataSource</code>.  Further, it seems there are settings for <code>maxIdle</code> and <code>maxWait</code> giving the impression that these connections are pooled as well.  Glassfish also allows these parameters regardless of the type of data source selected.</p>
  
  <ul>
  <li>Are <code>javax.sql.DataSource</code> pooled in an application server (or servlet container)?</li>
  <li>What (if any) advantages are there for choosing <code>javax.sql.ConnectionPoolDataSource</code> over <code>javax.sql.DataSource</code> (or vice versa)?</li>
  </ul>