DataSource和ConnectionPoolDataSource之间的区别 [英] Difference between DataSource and ConnectionPoolDataSource

查看:270
本文介绍了DataSource和ConnectionPoolDataSource之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

javax.sql.DataSource有什么区别 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之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆