我们正在运行一个带有Spring Hibernate MySql的J2EE应用程序,该应用程序在内部使用C3P0和Connector/J进行连池。
C3P0
c3p0-0.9.5-pre8.jar
c3p0-oracle-thin-extras-0.9.5-pre8.jar
mchange-commons-java-0.2.7.jar
Connector/J (Previous Version 5.1.7)
mysql-connector-java-5.1.30-bin.jar
C3P0配置
# Common properties
c3p0.initialPoolSize=10
c3p0.maxPoolSize=30
c3p0.minPoolSize=5
c3p0.acquireIncrement=5
c3p0.acquireRetryAttempts=0
c3p0.preferredTestQuery=SELECT 1
c3p0.idleConnectionTestPeriod=300
c3p0.numHelperThreads=10
c3p0.maxIdleTimeExcessConnections=240
c3p0.testConnectionOnCheckout=true
我的应用程序在一段时间后内部调用存储过程,我遇到以下错误
错误日志
4548717 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#2] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#_decrementPendingAcquires - decremented pending_acquires: 16
4548718 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#2] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#run - Acquisition series terminated successfully. Decremented pending_acquires [16], attempts_remaining: 0
4548721 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#6] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#trace - trace com.mchange.v2.resourcepool.BasicResourcePool@6242c657 [managed: 2, unused: 2, excluded: 12] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@57390ad3)
4548721 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#6] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#_decrementPendingAcquires - decremented pending_acquires: 15
4548721 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#6] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#run - Acquisition series terminated successfully. Decremented pending_acquires [15], attempts_remaining: 0
4548724 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#3] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#trace - trace com.mchange.v2.resourcepool.BasicResourcePool@6242c657 [managed: 3, unused: 3, excluded: 12] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@57390ad3)
4548724 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#3] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#_decrementPendingAcquires - decremented pending_acquires: 14
4548724 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#3] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#run - Acquisition series terminated successfully. Decremented pending_acquires [14], attempts_remaining: 0
4548726 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#5] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#trace - trace com.mchange.v2.resourcepool.BasicResourcePool@6242c657 [managed: 4, unused: 4, excluded: 12] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@57390ad3)
4548726 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#5] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#_decrementPendingAcquires - decremented pending_acquires: 13
4548726 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#5] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#run - Acquisition series terminated successfully. Decremented pending_acquires [13], attempts_remaining: 0
4548734 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#4] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#trace - trace com.mchange.v2.resourcepool.BasicResourcePool@6242c657 [managed: 5, unused: 5, excluded: 12] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@57390ad3)
4548735 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#4] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#_decrementPendingAcquires - decremented pending_acquires: 12
4548735 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#4] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#run - Acquisition series terminated successfully. Decremented pending_acquires [12], attempts_remaining: 0
4548735 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#1] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#trace - trace com.mchange.v2.resourcepool.BasicResourcePool@6242c657 [managed: 6, unused: 6, excluded: 12] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@57390ad3)
4548735 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#1] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#_decrementPendingAcquires - decremented pending_acquires: 11
4548735 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#1] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#run - Acquisition series terminated successfully. Decremented pending_acquires [11], attempts_remaining: 0
4548738 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#0] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#trace - trace com.mchange.v2.resourcepool.BasicResourcePool@6242c657 [managed: 7, unused: 7, excluded: 12] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@57390ad3)
4548739 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#0] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#_decrementPendingAcquires - decremented pending_acquires: 10
4548739 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#0] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#run - Acquisition series terminated successfully. Decremented pending_acquires [10], attempts_remaining: 0
4548739 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#8] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#trace - trace com.mchange.v2.resourcepool.BasicResourcePool@6242c657 [managed: 8, unused: 8, excluded: 12] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@57390ad3)
4548739 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#8] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#_decrementPendingAcquires - decremented pending_acquires: 9
4548740 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#8] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#run - Acquisition series terminated successfully. Decremented pending_acquires [9], attempts_remaining: 0
4548740 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#7] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#trace - trace com.mchange.v2.resourcepool.BasicResourcePool@6242c657 [managed: 9, unused: 9, excluded: 12] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@57390ad3)
4548740 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#7] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#_decrementPendingAcquires - decremented pending_acquires: 8
4548740 [2F5DAE4C-9FFC-B232-F122-ABA87BCD5DB8:swapnil@ssg.com] [04/24/2014 13:01:13] [C3P0PooledConnectionPoolManager[identityToken->1e3ug9s9114xvrf9lm0waq|2b40c3b9]-HelperThread-#7] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#run - Acquisition series terminated successfully. Decremented pending_acquires [8], attempts_remaining: 0
4548912 [B94B4723-BE95-5E33-EDE2-DADA5DDCE0FD:swapnil@ssg.com] [04/24/2014 13:01:13] [http-bio-8081-exec-141] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#trace - trace com.mchange.v2.resourcepool.BasicResourcePool@59c12050 [managed: 7, unused: 1, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@5d5e3b92)
4548913 [B94B4723-BE95-5E33-EDE2-DADA5DDCE0FD:swapnil@ssg.com] [04/24/2014 13:01:13] [http-bio-8081-exec-141] DEBUG com.mchange.v2.resourcepool.BasicResourcePool#trace - trace com.mchange.v2.resourcepool.BasicResourcePool@59c12050 [managed: 7, unused: 1, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@5d5e3b92)
4548958 [C0EDCD6E-799E-EE3A-E0C6-27A38D5CE7DB:indra@ssg.com] [04/24/2014 13:01:13] [http-bio-8081-exec-91] ERROR org.hibernate.transaction.JDBCTransaction#toggleAutoCommit - Could not toggle autocommit
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 709,563 milliseconds ago. The last packet sent successfully to the server was 112 milliseconds ago.
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:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1127)
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3983)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2596)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2832)
at com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:5357)
现在,当我查看数据库日志时,我发现大多数查询都处于“创建排序索引”状态,如下所示
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE DB = "mydatabase";
-+---------+-----------+---------------+
| ID | USER | HOST | DB | COMMAND | TIME | STATE | INFO | TIME_MS | ROWS_SENT | ROWS_EXAMINED |
+---------+-----------+---------------+
| 923 | myuser | %:49513 | mydatabase | Query | 1049 | Creating sort index | MY Stored Procedure Query | 1048800 | 0 | 0 |
| 853 | myuser | %:37920 | mydatabase | Query | 3101 | Creating sort index | MY Stored Procedure Query 2 | 3101147 | 0 | 0 |
| 771 | myuser | %:42514 | mydatabase | Query | 3258 | Creating sort index | MY Stored Procedure Weekly Report | 3258032 | 0 | 0 |
| 924 | myuser | 127.0.0.1:49514 | mydatabase | Sleep | 149 | | NULL | 149272 | 1 | 0 |
| 854 | myuser | %:37921 | mydatabase | Query | 3082 | Creating sort index | MY Stored Procedure Query 4 | 3081772 | 0 | 0 |
| 926 | myuser | %:49516 | mydatabase | Query | 1049 | Creating sort index | MY Stored Procedure Weekly Report | 1048800 | 0 | 0 |
| 851 | myuser | %:37918 | mydatabase | Query | 3258 | Creating sort index | MY Stored Procedure Query | 3257389 | 0 | 0 |
| 881 | myuser | %:60298 | mydatabase | Query | 2634 | Creating sort index | MY Stored Procedure Weekly Report | 2634119 | 0 | 0 |
| 873 | myuser | %:33062 | mydatabase | Query | 3052 | Creating sort index | MY Stored Procedure Weekly Report | 3051387 | 0 | 0 |
| 874 | myuser | %:33063 | mydatabase | Query | 2996 | Creating sort index | MY Stored Procedure Query 4 | 2996020 | 0 | 0 |
| 875 | myuser | %:33064 | mydatabase | Query | 3051 | Creating sort index | MY Stored Procedure Query 3 | 3050931 | 0 | 0 |
| 876 | myuser | %:33065 | mydatabase | Query | 3005 | Creating sort index | MY Stored Procedure Query | 3005103 | 0 | 0 |
| 877 | myuser | %:33066 | mydatabase | Query | 3005 | Creating sort index | MY Stored Procedure Query 3 | 3005103 | 0 | 0 |
| 887 | myuser | %:60303 | mydatabase | Query | 2370 | Creating sort index | MY Stored Procedure Query 5 | 2370288 | 0 | 624783 |
| 888 | myuser | %:60304 | mydatabase | Query | 2634 | Creating sort index | MY Stored Procedure Query | 2634142 | 0 | 0 |
| 889 | myuser | %:60305 | mydatabase | Query | 2635 | Creating sort index | MY Stored Procedure Query 4 | 2635321 | 0 | 0 |
| 890 | myuser | %:60306 | mydatabase | Query | 2636 | Creating sort index | MY Stored Procedure Query 6 | 2635389 | 0 | 0 |
| 893 | myuser | %:60335 | mydatabase | Query | 2634 | Creating sort index | MY Stored Procedure Query 3 | 2633677 | 0 | 0 |
| 894 | myuser | %:60336 | mydatabase | Query | 2634 | Creating sort index | MY Stored Procedure Query 7 | 2633830 | 0 | 0 |
| 895 | myuser | %:60337 | mydatabase | Query | 2602 | Creating sort index | MY Stored Procedure Weekly Report | 2601646 | 0 | 0 |
| 896 | myuser | %:60338 | mydatabase | Query | 2633 | Creating sort index | MY Stored Procedure Query 4 | 2633061 | 0 | 0 |
| 897 | myuser | %:60339 | mydatabase | Query | 2634 | Creating sort index | MY Stored Procedure Query 4 | 2634026 | 0 | 0 |
| 863 | myuser | %:33046 | mydatabase | Query | 3052 | Creating sort index | MY Stored Procedure Query 4 | 3052325 | 0 | 0 |
| 928 | myuser | %:49518 | mydatabase | Query | 1049 | Creating sort index | MY Stored Procedure Query 4 | 1048805 | 0 | 0 |
| 925 | myuser | 127.0.0.1:49515 | mydatabase | Sleep | 149 | | NULL | 149273 | 1 | 0 |
| 864 | myuser | %:33045 | mydatabase | Query | 3099 | Creating sort index | MY Stored Procedure Query 7 | 3098693 | 0 | 0 |
| 865 | myuser | %:33047 | mydatabase | Query | 3061 | Creating sort index | MY Stored Procedure Query 3 | 3060639 | 0 | 0 |
| 866 | myuser | %:33048 | mydatabase | Query | 3062 | Creating sort index | MY Stored Procedure Query 4 | 3062017 | 0 | 0 |
| 867 | myuser | %:33049 | mydatabase | Query | 3062 | Creating sort index | MY Stored Procedure Weekly Report | 3061918 | 0 | 0 |
| 855 | myuser | %:37922 | mydatabase | Query | 3257 | Creating sort index | MY Stored Procedure Query 3 | 3257106 | 0 | 0 |
| 778 | myuser | %:42523 | mydatabase | Query | 3114 | Creating sort index | MY Stored Procedure Query 5 | 3113575 | 0 | 624783 |
| 776 | myuser | %:42519 | mydatabase | Query | 3016 | Creating sort index | MY Stored Procedure Query 5 | 3015348 | 0 | 624783 |
32 rows in set (0.39 sec)
有人能帮我吗...
编辑
1.c3p0初始化日志
INFO com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource#getPoolManager - Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 5, acquireRetryAttempts -> 0, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, dataSourceName -> 1e3ug9s9115zzlcg148d713|36592bb1, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceUseNamedDriverClass -> false, identityToken -> 1e3ug9s9115zzlcg148d713|36592bb1, idleConnectionTestPeriod -> 300, initialPoolSize -> 10, jdbcUrl -> jdbc:mysql://127.0.0.1:33073/rptdb_qa?useOldAliasMetadataBehavior=true&autoReconnect=true&failOverReadOnly=false&maxReconnects=10, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 240, maxPoolSize -> 30, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 5, numHelperThreads -> 10, preferredTestQuery -> SELECT 1, privilegeSpawnedThreads -> false, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> true, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]
mysql> show variables like '%timeout%';
+-----------------------------+----------+
| Variable_name | Value |
+-----------------------------+----------+
| connect_timeout | 10 |
| delayed_insert_timeout | 300 |
| have_statement_timeout | YES |
| innodb_flush_log_at_timeout | 1 |
| innodb_lock_wait_timeout | 50 |
| innodb_rollback_on_timeout | OFF |
| interactive_timeout | 3600 |
| lock_wait_timeout | 31536000 |
| net_read_timeout | 30 |
| net_write_timeout | 60 |
| rpl_stop_slave_timeout | 31536000 |
| slave_net_timeout | 3600 |
| thread_pool_idle_timeout | 60 |
| wait_timeout | 3600 |
+-----------------------------+----------+
有几件事。
>
你的c3p0配置是奇怪的。您确定c3p0已配置为您想要的吗?标准c3p0.properties文件中的C3p0属性看起来像c3p0.propertyName
而不是jdbc.propertyName
。要使您的配置生效,您必须读取此文件并以编程方式设置这些属性。要检查,c3p0在池初始化时将配置信息转储到INFO。看那里。
通常,为了防止连接超时,您需要某种形式的连接测试。您当前只有一个测试启用配置参数,testConnectionOnCheckout
,它被注释掉了。
可能你的种类需要很长时间。但如果问题是超时(也许不是!)你的连接似乎时间非常快,仅仅过了710秒,不到12分钟。您可以考虑检查并在必要时更新服务器端超时设置。还有一些与超时相关的设置可以包含在JDBC url中。
看看这个堆栈溢出应答通信异常:通信链路故障问题可能与结果的长度有关。
我试图连接我的java应用程序与SQL数据库和当我点击保存按钮它给我以下错误 这是我的密码
我有一个使用Tomcat和MySQL的生产服务器。今天,所有网站都停止了与各自数据库的连接。 重新启动Tomcat时,显示无法为所有网站/数据库创建连接池。以下是错误日志(针对一个网站): 以及根的含量。xml是: 这个问题从今天开始,我已经没有选择了。它可能在几个月(或几年)内运行良好。 我已经尝试从url参数中删除"serverTimezone",使用服务器的IP而不是127.0.0.1和其他
我用java从MySQL查询了一些记录。但是在一些查询中,我遇到了一个问题,使查询失败,但在其他情况下,它查询成功。错误消息是下一个: 我尝试过一些方法,比如: 在 但什么都没发生。 我的环境是: MySQL: 5.5.3-m3-log源代码分布 Java: 1.60_16 jdk: HotSpot(TM)64位服务器VM(构建14.2-b01,混合模式) JDBC: mysql连接器-java-
我有一个带有JDBC mysql连接的服务器,但每天早上检查服务器时都会出现这样的错误: 在com.mysql.jdbc.mysqlio.readfly(mysqlio.java:1395)在com.mysql.jdbc.mysqlio.reuseandreadpacket(mysqlio.java:1539)在com.mysql.jdbc.mysqlio.checkerrorpacket(mys
我在Stackoverflow的另一个问题中尝试了这个建议,并在连接方面做了如下更改 但我的项目还是失败了 严重:执行身份验证com时发生异常。mysql。jdbc。例外情况。jdbc4。通信异常:通信链路故障 谁能告诉我克服这个问题的最好方法是什么?
这是一个错误: 无databaseCom.mysql.jdbc.exceptions.jdbc4.CommunicationsException:通信链接失败 从服务器成功接收的最后一个数据包是在1,325毫秒前。最后一个成功发送到服务器的数据包是在1,316毫秒之前。 这是我的代码: