# HG changeset patch
# User Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
# Date 1483381816 0
# Node ID 3db0dd9676773a02567fe455c7456b3109a265c2
# Parent  073ee535234b37b715dd09aae32c4f4486c9c66f
Fixed the class loading, started to test the JDBC embedded connection. However there is small issue that I have to check with other MonetDB Lite bindings relative to the dlopen system call.

diff --git a/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in b/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in
+++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in
@@ -68,8 +68,6 @@ final public class MonetDriver implement
 	/** MonetDB default port to connect to */
 	private static final String PORT = "@JDBC_DEF_PORT@";
 
-    private static final ClassLoader MonetDBClassLoader = MonetDriver.class.getClassLoader();
-
     private static Class EmbeddedConnectionClass = null;
 
 	// initialize this class: register it at the DriverManager
@@ -413,16 +411,15 @@ final public class MonetDriver implement
 			if (directory == null || directory.trim().isEmpty())
 				throw new IllegalArgumentException("directory should not be null or empty");
 			try {
-			    if(EmbeddedConnectionClass != null) {
-			        EmbeddedConnectionClass = MonetDBClassLoader
-                        .loadClass("nl.cwi.monetdb.embedded.jdbc.EmbeddedConnection");
+			    if(EmbeddedConnectionClass == null) {
+			        EmbeddedConnectionClass = Class.forName("nl.cwi.monetdb.embedded.jdbc.EmbeddedConnection");
 			    }
-				if(EmbeddedConnectionClass == null) {
+				if(EmbeddedConnectionClass == null) { //if it's still null then there is a problem
 					throw new SQLException("EmbeddedConnection Class not found!");
 				}
-
                 res = (MonetConnection) EmbeddedConnectionClass
-                    .getDeclaredConstructor(Properties.class, String.class, String.class, Boolean.TYPE, String.class)
+                    .getDeclaredConstructor(Properties.class, String.class, String.class, String.class,
+                                            Boolean.TYPE, String.class)
                     .newInstance(props, database, hash, language, blobIsBinary, directory);
 			} catch (InvocationTargetException | InstantiationException | IllegalAccessException |
 			         NoSuchMethodException | ClassNotFoundException e) {