javax.sql.DataSource and javax.sql.ConnectionPoolDataSource
posted 6 years ago
When creating a connection pool in Glassfish, I am confused with these two options:
javax.sql.DataSource and javax.sql.ConnectionPoolDataSource.
What is the difference between javax.sql.DataSource and javax.sql.ConnectionPoolDataSource ?
I thought every implementation of javax.sql.DataSource supports connection pooling. ( Not just javax.sql.ConnectionPoolDataSource )
Also, I read somewhere that some app servers like Glassfish will use ConnectionPoolDataSource regardless and expose just DataSource.
If we close the connection returned by (getConnection() of javax.sql.DataSource), wont that go back to connection pool ?
Let me put it this way :
What is the necessity of having javax.sql.ConnectionPoolDataSource, when javax.sql.DataSource itself supports pooling.
Am I assuming anything? Will every app server implements DataSource such a way that is supports pooling? Yes/No ?