Changeset: 3d6834ac2039 for monetdb-java
URL: https://dev.monetdb.org/hg/monetdb-java?cmd=changeset;node=3d6834ac2039
Modified Files:
        build.properties
        pom.xml
        src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
Branch: embedded
Log Message:

In an embedded JDBC connection, don't check/set query timeouts while validating 
the connection.


diffs (61 lines):

diff --git a/build.properties b/build.properties
--- a/build.properties
+++ b/build.properties
@@ -19,7 +19,7 @@ MCL_MINOR=14
 # major release number
 JDBC_MAJOR=2
 # minor release number
-JDBC_MINOR=33
+JDBC_MINOR=34
 # an additional identifying string
 JDBC_VER_SUFFIX=Liberica
 # the default port to connect on, if no port given when using SQL
diff --git a/pom.xml b/pom.xml
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
 
        <groupId>monetdb</groupId>
        <artifactId>monetdb-jdbc-new</artifactId>
-       <version>2.33</version>
+       <version>2.34</version>
        <name>MonetDB JDBC new</name>
        <description>MonetDB Adapted JDBC driver for embedded 
connection</description>
        <url>https://www.monetdb.org</url>
diff --git a/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java 
b/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
+++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
@@ -1163,7 +1163,7 @@ public abstract class MonetConnection ex
         */
        @Override
        public boolean isValid(int timeout) throws SQLException {
-               if (timeout < 0)
+               if (!isEmbedded && timeout < 0)
                        throw new SQLException("timeout is less than 0", 
"M1M05");
                if (closed)
                        return false;
@@ -1175,16 +1175,19 @@ public abstract class MonetConnection ex
                try {
                        stmt = createStatement();
                        if (stmt != null) {
-                               int original_timeout = stmt.getQueryTimeout();
-                               if (timeout > 0 && original_timeout != timeout) 
{
-                                       // we need to change the requested 
timeout for this test query
-                                       stmt.setQueryTimeout(timeout);
+                               int original_timeout = 0;
+                               if(!isEmbedded) {
+                                       original_timeout = 
stmt.getQueryTimeout();
+                                       if (timeout > 0 && original_timeout != 
timeout) {
+                                               // we need to change the 
requested timeout for this test query
+                                               stmt.setQueryTimeout(timeout);
+                                       }
                                }
                                rs = stmt.executeQuery("SELECT 1");
                                if (rs != null && rs.next()) {
                                        isValid = true;
                                }
-                               if (timeout > 0 && original_timeout != timeout) 
{
+                               if (!isEmbedded && timeout > 0 && 
original_timeout != timeout) {
                                        // restore the original server timeout 
value
                                        stmt.setQueryTimeout(original_timeout);
                                }
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to