db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Olav Sandstaa (JIRA)" <derby-...@db.apache.org>
Subject [jira] Commented: (DERBY-1090) Implement Connection.isValid as defined by JDBC4
Date Tue, 25 Apr 2006 14:21:06 GMT
    [ http://issues.apache.org/jira/browse/DERBY-1090?page=comments#action_12376267 ] 

Olav Sandstaa commented on DERBY-1090:
--------------------------------------

The first implementation of Connection.isValid() for the client driver handles most failuire
situations. One situation that is not handled is if the server "hangs" and the client does
not receive a reply. The application will be hanging "forever" in the isValid() call due to
the blocking read on the socket even if a timeout value has been specified. I plan to submit
a fix to this problem by setting a timeout on the socket before the read is called on the
socket (using java.net.socket.setSoTimeout). One potential problem with using socket.setSoTimeout
is that its implementation is platform dependent. Some operating systems might not support
the timeout value and block forever on socket operations even if a timeout is set.

I would appreciate to hear if anybody has better or alternative solutions on how to handle
the problem with blocking socket read and hanging server. 



> Implement Connection.isValid as defined by JDBC4
> ------------------------------------------------
>
>          Key: DERBY-1090
>          URL: http://issues.apache.org/jira/browse/DERBY-1090
>      Project: Derby
>         Type: Sub-task

>   Components: JDBC
>     Reporter: Olav Sandstaa
>     Assignee: Olav Sandstaa
>     Priority: Minor
>      Fix For: 10.2.0.0
>  Attachments: client1090_patch1.diff, embedded1090-isclosed.diff, embedded1090-query.diff
>
> The Javadoc for JDBC4 says this about Connection.isValid:
> boolean isValid(int timeout) throws SQLException
> Returns true if the connection has not been closed and is still valid. The driver shall
submit a query on the connection or use some other mechanism that positively verifies the
connection is still valid when this method is called. 
> The query submitted by the driver to validate the connection shall be executed in the
context of the current transaction. 
> Parameters: timeout - - The time in seconds to wait for the database operation used to
validate the connection to complete. If the timeout period expires before the operation completes,
this method returns false. A value of 0 indicates a timeout is not applied to the database
operation. 
> Returns: true if the connection is valid, false otherwise 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message