Changeset: 64530632dc2a for monetdb-java
URL: http://dev.monetdb.org/hg/monetdb-java?cmd=changeset;node=64530632dc2a
Modified Files:
        src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
        src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in
Branch: embedded
Log Message:

Added the directory property for the embedded connection again.


diffs (52 lines):

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);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to