# HG changeset patch
# User Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
# Date 1521628668 -3600
# Node ID 3d6834ac2039847365bf8c4c4cc03a38cfe5e2d8
# Parent  5b13ccaba741b14c90b9f850a50cad7daa5c1b85
In an embedded JDBC connection, don't check/set query timeouts while validating the connection.

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);
 				}