changeset 86:3db0dd967677 embedded

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.
author Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
date Mon, 02 Jan 2017 18:30:16 +0000 (2017-01-02)
parents 073ee535234b
children 2b5e32efb1a4
files src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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) {