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.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus