I use JDBC for connect to Oracle database. Application is running very long time. So I need to know that the connection was not closed by server and that a network disconnect didn't happen etc.
I cannot use isValid
because this is not supported by the JDBC driver.
Running a simple query, something like
SELECT 1
FROM dual
is the most foolproof approach. That's what most Java EE app servers do to verify that a connection from their connection pool is still active.