gpt4 book ai didi

java - 应用程序服务器实现的 JDBC 数据源

转载 作者:行者123 更新时间:2023-12-02 07:13:47 28 4
gpt4 key购买 nike

我正在学习数据源,我想我开始理解它,但我不明白这一段。

据我所知,MySQL 和 PostgreSQL 等数据库供应商编写了自己的不同 DataSource 接口(interface)的实现。现在,这还不够吗?应用程序服务器应该提供 DataSource 实现是什么意思?这样做的原因是什么?

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

最佳答案

通常,webapp 数据源将委托(delegate)给 PostgreSQL 实现。这允许在网络应用程序中进行监控和其他功能,如果您管理自己的数据源,则这些功能将不可用。

关于java - 应用程序服务器实现的 JDBC 数据源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15209242/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com