[ http://issues.apache.org/jira/browse/DERBY-1090?page=comments#action_12371210 ]
Olav Sandstaa commented on DERBY-1090:
--------------------------------------
Dan, thanks for the suggestion of only using isClosed in the embedded driver. I have also
wondered if calling isClosed would be sufficient, and actually I have not been able to create
a scenario where isClosed returns false followed by simple query that fails.
The main reasons for including execution of a simple query also in the embedded driver are:
* I do not know the code well enough to be sure that there will not be situations where isClosed
returns false and a query returns e.g., a timeout or exception due to some resource constraints,
deadlock or other error situations.
* It will make the behavior and implementation more similar between what is done in the embedded
and in the client driver.
I will probably submit a patch for how isValid can be implemented for the Embedded server
containing both a check for isClosed and a query. If you or other on the list still thinks
it is unnecessary to include execution of a query I will remove it.
> 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
|