# HG changeset patch
# User Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
# Date 1503593173 -7200
# Node ID 2abd488159c43a617b61ec6d19483fb2a11f91dd
# Parent  36f55bb8dd5781b3a70f25ade21a8926fca80542
Implemented PreparedStatement method setURL(int, URL).

diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,7 +2,8 @@
 # This file is updated with Maddlog
 
 * Thu Aug 24 2017 Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
-- Implemented PreparedStatement method setNString().
+- Implemented PreparedStatement method setURL(int, URL).
+- Implemented PreparedStatement method setNString(int, String).
 - The MonetDB JDBC driver code and jdbcclient program are now compiled
   without debug info and with optimise flag enabled.  The new jar files are
   now smaller in size.
diff --git a/release.txt b/release.txt
--- a/release.txt
+++ b/release.txt
@@ -56,7 +56,7 @@ Currently implemented JDBC 4.1 interface
     - setAsciiStream, setBinaryStream, setUnicodeStream
     - setBlob
     - setNCharacterStream, setNClob
-    - setRef, setRowId, setSQLXML, setURL
+    - setRef, setRowId, setSQLXML
 
   * java.sql.ParameterMetaData
 
diff --git a/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java b/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
+++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
@@ -2499,7 +2499,15 @@ public class MonetPreparedStatement
 	 */
 	@Override
 	public void setURL(int parameterIndex, URL x) throws SQLException {
-		throw newSQLFeatureNotSupportedException("setURL");
+		if (x == null) {
+			setNull(parameterIndex, -1);
+			return;
+		}
+
+		String val = x.toString();
+		setValue(parameterIndex,
+			"url '" + val.replaceAll("\\\\", "\\\\\\\\").replaceAll("'", "\\\\'") + "'"
+		);
 	}
 
 	/**