Mercurial > hg > monetdb-java
changeset 111:d7added7aaf3 embedded
Small fixes for the JDBC embedded connection: proper error display and port removal.
author | Pedro Ferreira <pedro.ferreira@monetdbsolutions.com> |
---|---|
date | Wed, 25 Jan 2017 15:04:17 +0100 (2017-01-25) |
parents | 8af0a7387b4e |
children | 53ef497672bf |
files | src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in |
diffstat | 2 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java +++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java @@ -1672,10 +1672,12 @@ public abstract class MonetConnection ex SQLException ret = null; String[] errors = error.split("\n"); for (String error1 : errors) { + String error2 = isEmbedded() ? error1 : error1.substring(0, 5); + String error3 = isEmbedded() ? "M0M10" : error1.substring(6); if (ret == null) { - ret = new SQLException(error1.substring(6), error1.substring(0, 5)); + ret = new SQLException(error2, error3); } else { - ret.setNextException(new SQLException(error1.substring(6), error1.substring(0, 5))); + ret.setNextException(new SQLException(error2, error3)); } } throw ret;
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in +++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in @@ -364,7 +364,6 @@ final public class MonetDriver implement public Connection connect(String url, Properties info) throws SQLException { int tmp; Properties props = new Properties(); - props.put("port", PORT); props.putAll(info); info = props; @@ -461,7 +460,7 @@ final public class MonetDriver implement boolean negative1 = false, failedparse1 = false; int port = 0; try { - port = Integer.parseInt(props.getProperty("port")); + port = Integer.parseInt(props.getProperty("port", PORT)); } catch (NumberFormatException e) { failedparse1 = true; props.setProperty("port", PORT);