开发者

Simple DB2 Query for connection validation

开发者 https://www.devze.com 2022-12-29 20:24 出处:网络
I\'m looking for a simple DB2 query that can be used to test if a database connection in pool is still valid.It needs to be a generic q开发者_如何学JAVAuery that would execute regardless of which data

I'm looking for a simple DB2 query that can be used to test if a database connection in pool is still valid. It needs to be a generic q开发者_如何学JAVAuery that would execute regardless of which databases exist.

For other database servers, I've used something like 'SELECT 1' or 'SELECT version();'

What would be an equivalent for DB2?

Thanks!


Try values 1.

Also, you can get the current date as

VALUES current date 

or

SELECT current date FROM sysibm.sysdummy1 

You can also get the version info as follows

SELECT service_level, fixpack_num, bld_level
FROM TABLE (sysproc.env_get_inst_info()) as A;
0

精彩评论

暂无评论...
验证码 换一张
取 消