changeset 211:3d6834ac2039 embedded

In an embedded JDBC connection, don't check/set query timeouts while validating the connection.
author Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
date Wed, 21 Mar 2018 11:37:48 +0100 (2018-03-21)
parents 5b13ccaba741
children ff9049259602
files build.properties pom.xml src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
diffstat 3 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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>
--- 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);
 				}