Slide's connectIfNeeded method didn't work, so i did check. Here is what the spec says at http://java.sun.com/products/jdk/1.2/docs/guide/jdbc/spec2/jdbc2.0.frame11.html
"11 Clarifications We have gotten several requests to clarify some aspects of the JDBC API. This chapter contains additional explanation of some JDBC features. 11.1 Connection.isClosed() The Connection.isClosed() method is only guaranteed to return true after Connection.closed() has been called. Connection.isClosed() cannot be called, in general, to determine if a database connection is valid or invalid. A typical JDBC client can determine that a connection is invalid by catching the exception that is thrown when a JDBC operation is attempted." This also affects the semantics of our isConnected() method. cheers, Jason Remy Maucherat wrote: >>Hi >> >>Currently with the JDBCDescriptorsStore, when the database connection is >>unexpectedly lost, we have to restart Tomcat to recreate the connection. >> >>I've attached a stack trace which shows the problem. >> >>I thought it looked easy enough to solve - just add connectIfNeeded() >>before each attempt to use the connection (catching >>ServiceConnectionFailedException). >> >>But isClosed() as used in that method can't actually determine whether >>the connection is invalid, so instead, i try to connect if >>connection.prepareStatement throws an SLQException. >> >>Patch is attached. >> > > Maybe, but shouldn't isClosed return the actual status of the connection ? > If the spec says it should, then I don't think we should add some other > workarounds in the code. > > Remy > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
