Hi,
I have a
Java program that creates a java.sql.Connection to a database, inserts records, closes the connection and exits.
My question is - how do I know if the connection has been terminated by some external means (e.g. DBA terminates my db session, database shuts down etc.)? Right now, my program keeps trying to insert records even if the connection is terminated and hence keeps giving errors.
I tried connection.isClosed(), but it returns true only if the connection has been closed by the Java program itself. If the connection is terminated outside of the Java program, it seems to return false.
Ravi