LuckyLuke
LuckyLuke

Reputation: 49077

JDBC Datasources implemented by app servers

I am learning about datasources and I think I am beginning to understand it but this paragraph I don't get.

From what I know now the database vendors such as MySQL and PostgreSQL write their own implementations of the different DataSource interfaces. Now, shouldn't that be sufficient? What does it mean by the app server should provide a DataSource implementation? What is the reason for doing so?

PostgreSQL implementation of ConnectionPoolDataSource. The app server or middleware vendor should provide a DataSource implementation that takes advantage of this ConnectionPoolDataSource. If not, you can use the PostgreSQL implementation known as PoolingDataSource, but that should only be used if your server or middleware vendor does not provide their own. Why? The server may want to reuse the same Connection across all EJBs requesting a Connection within the same Transaction, or provide other similar advanced features.

http://jdbc.postgresql.org/documentation/publicapi/org/postgresql/ds/PGConnectionPoolDataSource.html

Upvotes: 0

Views: 120

Answers (1)

Andres Olarte
Andres Olarte

Reputation: 4380

Normally the webapp DataSource will delegate to the PostgreSQL implementation. This allows monitoring and other features in the webapp, which wouldn't be available if you manage your own datasources.

Upvotes: 2

Related Questions