# HG changeset patch # User Pedro Ferreira <pedro.ferreira@monetdbsolutions.com> # Date 1484236266 -3600 # Node ID 64530632dc2a278c3d707e210db0bf68d628b489 # Parent 1dcb51573c89b89cc0da3b169d270cc541c2d39e Added the directory property for the embedded connection again. 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 @@ -1113,7 +1113,7 @@ public abstract class MonetConnection ex if (name.equals("host") || name.equals("port") || name.equals("user") || name.equals("password") || name.equals("database") || name.equals("language") || name.equals("so_timeout") || name.equals("hash") || name.equals("treat_blob_as_binary") || name.equals("follow_redirects") || - name.equals("treat_clob_as_longvarchar") || name.equals("embedded")) { + name.equals("treat_clob_as_longvarchar") || name.equals("embedded") || name.equals("directory")) { conn_props.setProperty(name, value); } else { addWarning("setClientInfo: " + name + "is not a recognised property", "01M07"); 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 @@ -193,6 +193,11 @@ final public class MonetDriver implement prop.description = "Whether or not to use an embedded MonetDB connection"; props.add(prop); + prop = new DriverPropertyInfo("directory", ""); + prop.required = false; + prop.description = "Sets the directory to set the database in a embedded connection (Embedded connection only)"; + props.add(prop); + DriverPropertyInfo[] dpi = new DriverPropertyInfo[props.size()]; return props.toArray(dpi); } @@ -421,15 +426,19 @@ final public class MonetDriver implement if(isEmbedded) { //instantiate the connection try { + String directory = props.getProperty("directory"); + if (directory == null || directory.trim().isEmpty()) + throw new IllegalArgumentException("directory should not be null or empty"); + if(EmbeddedConnectionClass == null) { EmbeddedConnectionClass = Class.forName("nl.cwi.monetdb.embedded.jdbc.EmbeddedConnection"); + if(EmbeddedConnectionClass == null) { //if it's still null then there is a problem + throw new SQLException("EmbeddedConnection Class not found! Please load the MonetDBJavaEmbedded JAR!"); + } } - 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) - .newInstance(props, hash, language); + .getDeclaredConstructor(Properties.class, String.class, String.class, String.class) + .newInstance(props, hash, language, directory); } catch (InvocationTargetException | InstantiationException | IllegalAccessException | NoSuchMethodException | ClassNotFoundException e) { throw new SQLException(e);