什么是连接池的最佳方法? [英] What is best approach for connection pooling?

查看:71
本文介绍了什么是连接池的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在项目中实施连接池。
性能明智哪个更好的方法呢?


  • Hibernate(使用C3PO或DBCP)

  • 在应用程序服务器中配置JDBC数据源。


    应用程序服务器可移植性并不重要我的因素。
    请给出建议方法。 解析方案

连接池在 DataSource ,在这两种情况下,Hibernate都会使用数据源。



问题在于使用了哪个数据源实现,它是如何配置的:


  1. 您可以将数据源指定并配置到hibernate配置中。
  2. 您可以在应用程序中配置数据源。服务器,并在休眠配置中指定相应的JNDI名称。在这种情况下,您可以使用随应用程序一起提供的数据源实现。服务器。

在性能方面,我认为这个实现没有什么影响 - 更重要的是你是否希望你的 .war 取决于应用程序管理的资源。服务器(情况2)或不(情况1)。在情况1中,尽管C3P0更喜欢DBCP。

I am implementing connection pooling in project. Performance wise which is better approach to do it?

  • Hibernate (using C3PO or DBCP)
  • Configuring JDBC data-source in Application server.

Application server Portability is not an important factor for me. Please suggest the approach.

解决方案

Connection pooling is implemented in the DataSource, and in both case Hibernate will use a datasource.

The question is which data source implementation is used, and how is it configured:

  1. You can specify and configure the datasource right into the hibernate configuration
  2. You can configure the datasource in the app. server, and specify the corresponding JNDI names in the hibernate configuration. In this case you use the datasource implementation that ships with the app. server.

Performance-wise, I think the implementation has little impact -- it's more whether you want your .war to be dependent on resources managed by the app. server (case 2) or not (case 1). In case 1, prefer C3P0 to DBCP though.

这篇关于什么是连接池的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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