繁体   English   中英

Hibernate c3p0配置没有影响

[英]Hibernate c3p0 configuration has no affect

我正在尝试将c3p0连接池添加到我们现有的休眠配置中。 但是它没有任何影响,休眠状态仍使用默认池。 单独使用Hibernate Configuration可以正常工作,所以我绝对可以确定它没有问题。

想知道这里有人可以指出我的错误还是建议我如何调试问题?

我不使用Spring框架。

<hibernate-configuration>
<session-factory>

<property name="hibernate.connection.driver_class">com.ibm.db2.jcc.DB2Driver</property>
    <property name="hibernate.connection.password">passwd</property>
    <property name="hibernate.connection.url">jdbc:db2://server:port/database</property>
    <property name="hibernate.connection.username">username</property>

    <property name="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
    <property name="hibernate.connection.autocommit">false</property>
    <property name="hibernate.current_session_context_class">thread</property>
    <property name="hibernate.default_schema">DB Schema</property>
    <property name="hibernate.dialect">org.hibernate.dialect.DB2Dialect</property>
    <property name="hibernate.format_sql">false</property>
    <property name="hibernate.max_fetch_depth">4</property>
    <property name="hibernate.search.autoregister_listeners">false</property>
    <property name="hibernate.show_sql">false</property>
    <property name="hibernate.connection.isolation">1</property>
    <property name="hibernate.jdbc.batch_size">50</property>

<property name="hibernate.c3p0.min_size">5</property>
<property name="hibernate.c3p0.max_size">20</property>
<property name="hibernate.c3p0.timeout">3000</property>
<property name="hibernate.c3p0.max_statements">50</property>
<property name="hibernate.c3p0.idle_test_period">900</property>

<mapping resource="table.hbm.xml" />

</session-factory>
</hibernate-configuration>

这是我有的罐子:

hibernate3.jar
hibernate-c3p0-3.5.0-Final.jar

日志中的语句:

hibernate.cfg.Environment - Hibernate 3.5.0-Final
INFO  ManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
INFO  ManagerConnectionProvider - Hibernate connection pool size: 20

尝试从c3p0配置连接提供程序类。

<property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>

另外,最好添加休眠配置文档类型,这将有助于查找任何错别字。

<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

更新您需要在类路径中包括mchange库。 链接可能对您有所帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM