使用JDBC连接池的时候,一般需要定义一个连接测试的SQL,下表中收集了几种常见数据库的testQuery
数据库 | 测试SQL |
Oracle | select 1 from dual |
DB2 | select 1 from sysibm.sysdummy1 |
MySql | select 1 |
SQL Server | select 1 |
PostgreSQL | select 1 |
hsqldb | SELECT 1 FROM INFORMATION_SCHEMA.SYSTEM_USERS |
H2 | select 1 |
SQLite | select 1 |
Ingres | select 1 |
Apache Derby | VALUES 1 FROM SYSIBM.SYSDUMMY1 |
Informix | select count(*) from systables |