问题描述
和 javax.sql.ConnectionPoolDataSource ?当我在GlassFish for MySQL中创建连接池时,我不知道使用哪种资源类型。
ConnectionPoolDataSource
只是一个 DataSource
(,因为它继承了 CommonDataSource
也可以通过 DataSource
继承并具有Connection Pooling功能 -
你问:我不知道使用哪种资源类型
这取决于你的应用程序,许多数据库驱动程序需要需要很长时间才能创建与数据库的新连接,如果您的应用程序要创建太多的连接(非常频繁)。使用连接池。
What is the difference between javax.sql.DataSource and javax.sql.ConnectionPoolDataSource? I don't know which resource type to use when I am creating a connection pool in GlassFish for MySQL.
ConnectionPoolDataSource
is just a DataSource
(as it inherit's CommonDataSource
which is also inherited by DataSource
) with capability of Connection Pooling -
you asked : I don't know which resource type to use
It depend's on your application, many database drivers take a long time to create a new connection with database, If your application is going to create too many connection's (very frequently). use connection pooling.
这篇关于DataSource和ConnectionPoolDataSource之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!