The last packet successfully received from the server was XXX seconds ago
2012-04-10 13:38
656 查看
Database Connection Pools
Using a connection pool is recommended for improving the performance of your application, and to ensure that your application handles excessive concurrency without overloading your Shared Database configurations (which have a limited number of connectionsavailable to the application). CloudBees datasources use the
Apache DBCP connection pool implementation, which has a wide set of connection options. The configuration below is a good configuration for a lightly loaded application or an application
running in the free app+db tier.
<resource name="jdbc/DATASOURCE_NAME" auth="Container" type="javax.sql.DataSource"> <param name="username" value="USERNAME" /> <param name="password" value="PASSWORD" /> <param name="url" value="JDBC_URL" /> <!-- Connection Pool settings --> <param name="maxActive" value="5" /> <param name="maxIdle" value="2" /> <param name="maxWait" value="10000" /> <param name="removeAbandoned" value="true" /> <param name="removeAbandonedTimeout" value="60" /> <param name="logAbandoned" value="true" /> </resource>
Avoiding Database Idle Timeouts
MySQL includes a timeout that will close connections that have been idle for long periods of time. For improved Database performance, CloudBees DataSources use the Apache DBCP connection pool to reuse JDBC connections after they are closed by the application.If you use a connection that has been in the pool idle for too long, your application will likely experience the following error: "The last packet successfully received from the server was XXX seconds ago". The connection pool includes a setting the will validate
and throw out dead connections when calling javax.sql.DataSource.getConnection(). To use this setting, add the following XML params to your DataSource definition in cloudbees-web.xml.
<param name="validationQuery" value="SELECT 1" /> <param name="testOnBorrow" value="true" />http://wiki.cloudbees.com/bin/view/RUN/DatabaseGuide
相关文章推荐
- 彻底解决"The last packet successfully received from the server was * milliseconds ago"问题
- Spring连接mysql长时间空闲报错:The last packet successfully received from the server was xx millisecond ago...
- mysql超时:The last packet successfully received from the server was 172,848,658 milliseconds ago.
- com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 152,219,305 milliseconds ago.
- The last packet successfully received from the server was 2,926,157 milliseconds ago. The last packet sent successfully to the server was 2,926,158 milliseconds ago. is longer than the server configured value of 'wait_timeout'. 解决办法
- The last packet successfully received from the server was 30,516,920 milliseconds ago.
- The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
- (2)Mysql ----- The last packet successfully received from the server was *** millisecond ago.The
- MYSQL Communications link failure,The last packet successfully received from the server was
- Communications link failure,The last packet successfully received from the server was *** millisecon
- Communications link failure,The last packet successfully received from the server was *** millisecon
- The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received
- Communications link failure,The last packet successfully received from the server was *** millisecon
- mysql 报错Communications link failure,The last packet successfully received from the server was × mill
- The last packet successfully received from the server was 78,682,686 milliseconds ago
- 错误Communications link failure,The last packet successfully received from the server was的解决方法
- The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received
- Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received
- Communications link failure,The last packet successfully received from the server was × millisecon..