Testquery/validationquery settings for the JDBC Connection pool

Source: Internet
Author: User
Tags connection pooling microsoft sql server mysql in

You want to increase the test/validation of connections in the connection pool to prevent the database from thinking that the connection is dead and that the Web application server thinks the connection is still valid in the "Timeout problem with connector/j connection to MySQL in Tomcat" post. The MySQL documentation mentions the examples in the Tomcat document are validationquery, but there are a lot of posts on the web that are written by Testquery, which one does it use?

This is related to the implementation of the connection pool:
connection Pooling Implementation the Feature property name
The Tomcat JDBC Connection Pool Validationquery
The Apache Commons DBCP Connection Pool Validationquery
C3P0-JDBC3 Connection and Statement Pooling Preferredtestquery
Atomikos:tomcat Spring ActiveMQ MySQL JMX Integration
Analysis Atomikos data Connection pool source code, understand Testquery
Testquery



Also, the SQL statement that tests/verifies connection pooling connections varies by database:
Efficient SQL test query or validation query that would work across all (or most) databases
Dbcp-validationquery for different Databases

Combining the two posts, the summary results are as follows:

Database test/Validate Query
Mysql SELECT 1
PostgreSQL SELECT 1
Microsoft SQL Server SELECT 1
Sqlite SELECT 1
H2 SELECT 1
Ingres SELECT 1
Oracle Select 1 from dual
DB2 Select 1 from Sysibm.sysdummy1 or
SELECT Current date from sysibm.sysdummy1
Apache Derby VALUES 1 from SYSIBM. SYSDUMMY1 or
SELECT 1 from SYSIBM. SYSDUMMY1
Hsqldb SELECT 1 from any_existing_table WHERE 1=0 or
SELECT 1 from INFORMATION_SCHEMA. System_users
Informix Select COUNT (*) from Systables

Testquery/validationquery settings for the JDBC Connection pool

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.