You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Olav Sandstaa (JIRA)" <de...@db.apache.org> on 2006/03/20 22:28:59 UTC

[jira] Commented: (DERBY-1090) Implement Connection.isValid as defined by JDBC4

    [ http://issues.apache.org/jira/browse/DERBY-1090?page=comments#action_12371144 ] 

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

In case someone else have suggestions or ideas on how to best implement this functionality, here are some high-level initial thoughts on how to implement it:

  -to check the validity of the connection, issue a simple query like
   e.g., "VALUES (1)"

  -to implement the timeout, use the setQueryTimeout() method. 

This will hopefully be sufficient in the embedded version as I expect that for all error situations where the connection no longer is valid, an exception will be thrown when issuing the query.

For the Derby client we probably need some timeout mechanism in the client code (in addition to setting the query timeout) in order to detect that the server has not responded within before the specified timeout has elapsed. I have not studied the network code in details yet to find out if it already has code or hooks for specifying a timeout on the DRDA request to the server. Any suggestions on how to best implement this are welcome.


> 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

>
> 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