在 Oracle10g 上使用 c3p0 配置 Hibernate 连接池

发布于 2024-11-29 10:50:22 字数 2563 浏览 4 评论 0原文

我无法使用 c3p0 与 Hibernate 和 Oracle 获得连接池。数据库是Oracle 10.2,hibernate版本是3.6.5。当我从配置中取出 c3p0 设置时,它工作正常。

我尝试限制请求的连接数和处理的语句数,但仍然没有成功。

这是我的 config.xml 和堆栈跟踪:

<hibernate-configuration>
<session-factory>
    <property name="hibernate.bytecode.use_reflection_optimizer">false</property>
    <property name="hibernate.check_nullability">false</property>
    <property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
    <property name="hibernate.connection.password">BLAH</property>
    <property name="hibernate.connection.url">BLAH</property>
    <property name="hibernate.connection.username">BLAH</property>
    <property name="hibernate.current_session_context_class">thread</property>
    <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
    <property name="hibernate.format_sql">true</property>
    <property name="hibernate.search.autoregister_listeners">false</property>
    <property name="hibernate.show_sql">false</property>
    <!-- c3p0 pooling - not working -->
    <property name="hibernate.c3p0.min_size">1</property>
    <property name="hibernate.c3p0.max_size">1</property>
    <property name="hibernate.c3p0.timeout">100</property>
    <property name="hibernate.c3p0.max_statements">1</property>
    <property name="hibernate.c3p0.acquire_increment">1</property> 

    <mapping resource="com/ht/hitthenet/planet/InvL1Service.hbm.xml" />
    <mapping resource="com/ht/hitthenet/planet/VbbOrderAttributes.hbm.xml" />
    <mapping resource="com/ht/hitthenet/planet/InvPort.hbm.xml" />
    <mapping resource="com/ht/hitthenet/planet/VbbSvcOrder.hbm.xml" />
</session-factory>
</hibernate-configuration>



- com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@c7e8a7 -- Acquisition     Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception: 
java.sql.SQLException: Unsupported feature
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:227)
...

I am unable to get a connection pool using c3p0 with Hibernate and Oracle. The database is Oracle 10.2, and hibernate version is 3.6.5. When I take out the c3p0 settings from the config, it works fine.

I've tried to limit the number of connections requested and statements processed and still no luck.

Here is my config.xml and stack trace:

<hibernate-configuration>
<session-factory>
    <property name="hibernate.bytecode.use_reflection_optimizer">false</property>
    <property name="hibernate.check_nullability">false</property>
    <property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
    <property name="hibernate.connection.password">BLAH</property>
    <property name="hibernate.connection.url">BLAH</property>
    <property name="hibernate.connection.username">BLAH</property>
    <property name="hibernate.current_session_context_class">thread</property>
    <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
    <property name="hibernate.format_sql">true</property>
    <property name="hibernate.search.autoregister_listeners">false</property>
    <property name="hibernate.show_sql">false</property>
    <!-- c3p0 pooling - not working -->
    <property name="hibernate.c3p0.min_size">1</property>
    <property name="hibernate.c3p0.max_size">1</property>
    <property name="hibernate.c3p0.timeout">100</property>
    <property name="hibernate.c3p0.max_statements">1</property>
    <property name="hibernate.c3p0.acquire_increment">1</property> 

    <mapping resource="com/ht/hitthenet/planet/InvL1Service.hbm.xml" />
    <mapping resource="com/ht/hitthenet/planet/VbbOrderAttributes.hbm.xml" />
    <mapping resource="com/ht/hitthenet/planet/InvPort.hbm.xml" />
    <mapping resource="com/ht/hitthenet/planet/VbbSvcOrder.hbm.xml" />
</session-factory>
</hibernate-configuration>



- com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@c7e8a7 -- Acquisition     Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception: 
java.sql.SQLException: Unsupported feature
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:227)
...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

删除→记忆 2024-12-06 10:50:22

问题是数据库服务器通过 IP 地址限制连接。

Issue was the database server restricted connections by IP address.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文