com.mchange.v2.c3p0.SQLWarnings La base de datos tiene transacciones

时间:2015-03-03 13:44:46

标签: hibernate c3p0

我有一个JSF + Spring + Hibernate应用程序。使用c3p0 pool v.0.9.1然后部署它,日志会不断地向我发送SQLWarnings,如下所示,并且不知道原因。

spring上下文中c3po的配置是:

<bean id="datasource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
              destroy-method="close">
       <property name="driverClass" value="com.informix.jdbc.IfxDriver"/>
       <property name="jdbcUrl"
                      value="${url}" />
       <property name="user" value="${user}" />
       <property name="password" value="${password}" />
       <property name="initialPoolSize" value="1" />   
       <property name="maxPoolSize" value="20" />
       <property name="idleConnectionTestPeriod" value="150" />
       <property name="acquireIncrement" value="1" />
       <property name="maxStatements" value="0" />
       <property name="numHelperThreads" value="3" />
       <property name="maxIdleTime" value="3600" />     
</bean>

输出结果为:

    INFO  [com.mchange.v2.c3p0.SQLWarnings] La base de datos tiene transacciones
java.sql.SQLWarning: La base de datos tiene transacciones
        at com.informix.util.IfxWarnMsg.getSQLWarning(IfxWarnMsg.java:125)
        at com.informix.util.IfxWarnMsg.getSQLWarning(IfxWarnMsg.java:149)
        at com.informix.jdbc.IfxSqliConnect.addWarning(IfxSqliConnect.java:1817)
        at com.informix.jdbc.IfxSqliConnect.setWarnings(IfxSqliConnect.java:3935)
        at com.informix.jdbc.IfxSqliConnect.OpenDbInit(IfxSqliConnect.java:2591)
        at com.informix.jdbc.IfxSqliConnect.setDatabaseOpen(IfxSqliConnect.java:2465)
        at com.informix.jdbc.IfxSqli.callsetDatabaseOpen(IfxSqli.java:2496)
        at com.informix.jdbc.IfxSqli.executeOpenDatabase(IfxSqli.java:1712)
        at com.informix.jdbc.IfxSqliConnect.<init>(IfxSqliConnect.java:1242)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at com.informix.jdbc.IfxDriver.connect(IfxDriver.java:243)
        at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
        at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
        at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
        at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
        at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
        at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
        at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
        at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
2015-03-03 14:22:47,748 INFO  [com.mchange.v2.c3p0.SQLWarnings] Seleccionada base de datos de Informix Dynamic Server 2000
java.sql.SQLWarning: Seleccionada base de datos de Informix Dynamic Server 2000
        at com.informix.util.IfxWarnMsg.getSQLWarning(IfxWarnMsg.java:125)
        at com.informix.util.IfxWarnMsg.getSQLWarning(IfxWarnMsg.java:149)
        at com.informix.jdbc.IfxSqliConnect.addWarning(IfxSqliConnect.java:1817)
        at com.informix.jdbc.IfxSqliConnect.setWarnings(IfxSqliConnect.java:3941)
        at com.informix.jdbc.IfxSqliConnect.OpenDbInit(IfxSqliConnect.java:2591)
        at com.informix.jdbc.IfxSqliConnect.setDatabaseOpen(IfxSqliConnect.java:2465)
        at com.informix.jdbc.IfxSqli.callsetDatabaseOpen(IfxSqli.java:2496)
        at com.informix.jdbc.IfxSqli.executeOpenDatabase(IfxSqli.java:1712)
        at com.informix.jdbc.IfxSqliConnect.<init>(IfxSqliConnect.java:1242)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at com.informix.jdbc.IfxDriver.connect(IfxDriver.java:243)
        at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
        at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
        at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
        at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
        at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
        at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
        at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
        at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)

1 个答案:

答案 0 :(得分:0)

请参阅here以获取完整说明。

如果您想忽略SQLWarnings,快速解决方案是关闭日志记录配置文件中记录器com.mchange.v2.c3p0.SQLWarnings的日志记录。 (不要关闭所有c3p0日志记录,只需抑制这个记录器。)

更好的解决方案是找出DBMS / JDBC驱动程序发出这些警告的原因,然后解决这个问题。无论您是否使用c3p0,都会出现警告。只是c3p0主动检查并记录它们,这是很少有应用程序需要做的事情。

此外,c3p0-0.9.1现在是要使用的库的旧版本。我强烈建议您升级到当前版本c3p0-0.9.5