When I setup a connection pool or database tool with a new database profile I like to test that it works, here are some vendor specific SQL you can use to test your db connection.
Cloudscape | #SQL SELECT 1 |
#DB2 | #SQL SELECT COUNT(*) FROM SYSIBM.SYSTABLES |
#Informix | #SQL SELECT COUNT(*) FROM SYSTABLES |
#Microsoft SQL Server | #SQL SELECT COUNT(*) FROM SYSOBJECTS |
#MySQL | #SQL SELECT 1 |
#Oracle | #SQL SELECT 1 FROM DUAL |
#PointBase | #SQL SELECT COUNT(*) FROM SYSTABLES |
#PostgreSQL | #SQL SELECT 1 |
#Progress | #SQL SELECT COUNT(*) FROM SYSTABLES |
#Sybase | #SQL SELECT COUNT(*) FROM SYSOBJECTS |
This is useful because you don't often know what tables exist in a database to test a query with, you can't assume select * from person would work if no person table was created. These queries are for the builtin system database resource in the specific vendor database types, they should exist even on a freshly installed or blank database server.
No comments:
Post a Comment