gpt4 book ai didi

postgresql - Postgres Glassfish 池化

转载 作者:行者123 更新时间:2023-11-29 12:46:05 26 4
gpt4 key购买 nike

有些教程说使用 org.postgresql.ds.PGConnectionPoolDataSource 但有些教程说只是 org.postgresql.ds.PGSimpleDataSource...两者之间有什么区别?

最佳答案

不同之处在于类 org.postgresql.ds.PGConnectionPoolDataSource 实现了连接池,因此它可以提供一些性能优势。

根据文档:

Class PGSimpleDataSource

Simple DataSource which does not perform connection pooling. In order to use the DataSource, you must set the property databaseName. The settings for serverName, portNumber, user, and password are optional. Note: these properties are declared in the superclass.

Class PGConnectionPoolDataSource

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.

另见:

关于postgresql - Postgres Glassfish 池化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21634169/

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