Hi Laird,
Great insights on this murky topic.
On Oct 11, 2012, at 8:07 PM, Laird Nelson <ljnelson_at_gmail.com> wrote:
>
> In the case of DataSource, if the client uses an app server like Glassfish, you will be leveraging connection pooling provided by the app server.
>
> In the case of ConnectionPooledDataSource you can use connection pooling provided by the driver impl you are using.
>
> And that's exactly the opposite of what another gentleman told me, and the opposite of what the JDBC specification suggests in chapter 11 (one little snippet: "In FIGURE 11-1, the JDBC driver provides an implementation of ConnectionPoolDataSource that the application server uses to build and manage the connection pool." That suggests that GlassFish would manage the pool in both cases.). (This is why I am bringing this up, and why I knew it would be a long road towards getting an answer. :-))
That's the point I was trying to make. In the section below where I was discussing GF + Oracle I mentioned this behavior. In both cases you get a connection pool provided/managed by the AS but in the case of using ConnectionPoolDataSource you can leverage driver specific pooling functionality. Again this is just my take on the bits of things I've read but it would seem to agree with your snippet of the JDBC spec.
>
> For Glassfish, and I know your SO question specifically said you weren't interested in specific cases, I follow the Oracle documentation here [1] for the specific driver I am using.
>
> Notice in the case of Oracle it recommends choosing one of the following:
>
> oracle.jdbc.pool.OracleDataSource
> oracle.jdbc.xa.client.OracleXADataSource
> I may be way off base here since I haven't looked at the GF code but I think that if you were to combine javax.sql.DataSource and oracle.jdbc.pool.OracleDataSource you would get GF supplied connection pooling. If you used ConnectionPooledDataSource the GF connection pooling for that connection pool could leverage Oracle driver based connection pooling presumably via Additional Properties you add yourself assuming GF supports doing so. I haven't seen any specific documentation on this so I may be off base here.
>
> Yep, and I appreciate the response. Respectfully, however, that's why I brought it up: it's still unclear and based on anecdote rather than something we can all point to and say here, this is what THIS one does, and this is what this OTHER one does.
Agreed.
-Noah