Hello everybody,
we have the following problem with our Java application: Within our app we
have connection pool for JDBC connections which always should be opened.
We need this since several users should be served at the same time. The
app is running on a pc and is always available. But the problem is that
the data base (DB2-UDB) is on a AS400 which is rebooted every night. That
means that the JDBC connections become invalid. But unfortunately I do not
find the right approach so the app 'knows' what has happend and react with
a reconnect (and i do not understand why there is no callback method or
rather a addConnectionListener method. It could be so simple...).
So the question is how to detect that the connection is invalid. Is there
a reliable SQLException error code which I could use when I try to execute
a sql statement? Not to forget that the app uses transactions what means
that I may not catch any exception. Can anyone give me me a hint or
explain how to deal with the problem?
Thanks in advance
Robert Schneider
PS: Is it a problem to keep DB connections open, never close it?