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] Updated: (DERBY-1090) Implement Connection.isValid as defined by JDBC4
Date Fri, 24 Mar 2006 10:25:30 GMT
     [ http://issues.apache.org/jira/browse/DERBY-1090?page=all ]

Olav Sandstaa updated DERBY-1090:

    Attachment: embedded1090-isclosed.diff

This patch (embedded1090-isclosed.diff)  implementations Connection.isValid() for the embedded
driver by verifying that the connection 
is not closed (by calling isClosed()). If the connection is closed, isValid returns false,
otherwise it returns true. The timeout defined as a parameter to isValid is not used.

Compared to the previous patch I sent a few days ago (embedded1090-query.diff), this patch
does not run any query against Derby to validate the
connection. My proposal (also based on suggestions from Dan) is that we only check for isClosed()
in the embedded driver. I have not experienced any situation where isClosed returned false
and the query failed. If we later discover situations where the connection is not "valid"
even if isValid returns true, we can add a query as done in my first patch to isValid.


The patch extends the TestConnectionMethods.java test with test for isValid in the following

  -wrong parameter values (negative timeout) 
  -isValid with no timeout 
  -isValid with a specified timeout 
  -isValid on a connection that is closed 
  -isValid on a "open connection" to a database that is shutdown 

svn status reports: 

M      java/engine/org/apache/derby/impl/jdbc/EmbedConnection40.java
M      java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestConnectionMethods.java

I have run the JDBC4 tests using Java 1.6 and derbyall using Java 1.5 under Solaris 10 x86.
Only errors seen in the regression test was reported (runtimeinfo failed in derbynetmats).

The patch is complete for the embedded driver and can be reviewed and committed.

> 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:
>  Attachments: 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
> 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:
For more information on JIRA, see:

View raw message