Changeset: 8af0a7387b4e for monetdb-java URL: http://dev.monetdb.org/hg/monetdb-java?cmd=changeset;node=8af0a7387b4e Modified Files: src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java src/main/java/nl/cwi/monetdb/jdbc/MonetDataSource.java Branch: embedded Log Message:
Small fixes for the embedded connection. diffs (102 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 @@ -2,7 +2,6 @@ package nl.cwi.monetdb.jdbc; import nl.cwi.monetdb.mcl.connection.*; import nl.cwi.monetdb.mcl.connection.SenderThread; -import nl.cwi.monetdb.mcl.connection.mapi.MapiLanguage; import nl.cwi.monetdb.mcl.protocol.ProtocolException; import nl.cwi.monetdb.mcl.protocol.AbstractProtocol; import nl.cwi.monetdb.mcl.protocol.ServerResponses; @@ -394,7 +393,7 @@ public abstract class MonetConnection ex */ @Override public DatabaseMetaData getMetaData() throws SQLException { - if (this.language != MapiLanguage.LANG_SQL) { + if (!this.language.getRepresentation().equals("sql")) { throw new SQLException("This method is only supported in SQL mode", "M0M04"); } return new MonetDatabaseMetaData(this); @@ -1511,7 +1510,7 @@ public abstract class MonetConnection ex int size = (cachesize != 0 && !isEmbedded) ? cachesize : MonetConnection.this.getDefFetchsize(); size = maxrows != 0 ? Math.min(maxrows, size) : size; // don't do work if it's not needed - if (language == MapiLanguage.LANG_SQL && size != curReplySize && + if (!language.getRepresentation().equals("sql") && size != curReplySize && !Arrays.deepEquals(templ, language.getCommandTemplates())) { sendControlCommand(ControlCommands.REPLY_SIZE, size); // store the reply size after a successful change diff --git a/src/main/java/nl/cwi/monetdb/jdbc/MonetDataSource.java b/src/main/java/nl/cwi/monetdb/jdbc/MonetDataSource.java --- a/src/main/java/nl/cwi/monetdb/jdbc/MonetDataSource.java +++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetDataSource.java @@ -27,7 +27,7 @@ import java.util.logging.Logger; * * Additionally, pooled connections can be used when using a DataSource. * - * @author Fabian Groffen + * @author Fabian Groffen, Pedro Ferreira * @version 0.1 */ public class MonetDataSource extends MonetWrapper implements DataSource { @@ -37,7 +37,7 @@ public class MonetDataSource extends Mon private String description = "MonetDB database"; private String url = "jdbc:monetdb://localhost/"; private int loginTimeout; - private boolean isEmbedded; + private String directory; private final MonetDriver driver = new MonetDriver(); // the following properties are also standard: @@ -75,8 +75,9 @@ public class MonetDataSource extends Mon if (loginTimeout > 0) { props.put("so_timeout", Integer.toString(loginTimeout)); } - if(isEmbedded) { + if(directory != null) { props.put("embedded", "true"); + props.put("directory", directory); } return driver.connect(url, props); } @@ -184,21 +185,30 @@ public class MonetDataSource extends Mon } /** + * Gets the directory value + * + * @return the directory value + */ + public String getDirectory() { + return directory; + } + + /** + * Sets the directory value, meaning it wil start an embedded connection + * + * @param directory The directory location + */ + public void setDirectory(String directory) { + this.directory = directory; + } + + /** * Gets the embedded connection directory. If not, then a MAPI connection will be created instead. * * @return If the connection will be embedded. If not, then a MAPI connection will be created instead. */ public boolean isEmbedded() { - return isEmbedded; - } - - /** - * Sets the connection to be embedded - * - * @param isEmbedded A boolean to indicate if the connection will be embedded - */ - public void setIsEmbedded(boolean isEmbedded) { - this.isEmbedded = isEmbedded; + return directory != null; } /** _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list