Archive

Archive for February, 2012

Dummy/safe ping SQL queries

February 4th, 2012 1 comment

Just in case someone needs it, here’s a set of SQL ping queries I use in the application I work on now. This is mostly used when checking if a database is alive but I’m sure it will come in handy at other times as well :-)

ping_queries = {
    'access': 'SELECT 1',
    'db2': 'SELECT current_date FROM sysibm.sysdummy1',
    'firebird': 'SELECT current_timestamp FROM rdb$database',
    'informix': 'SELECT 1 FROM systables WHERE tabid=1',
    'mssql': 'SELECT 1',
    'mysql': 'SELECT 1+1',
    'oracle': 'SELECT 1 FROM dual',
    'postgresql': 'SELECT 1',
}

@fourthrealm

Share
Categories: Software Tags: