Mercurial > hg > monetdb-java
diff src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in @ 254:27b7166860c8
According to the JDBC specification if the JDBC URL is invalid, return null instead of an exception, so the DriverManager can keep looking for a suitable JDBC driver.
author | Pedro Ferreira <pedro.ferreira@monetdbsolutions.com> |
---|---|
date | Fri, 09 Nov 2018 10:59:36 +0100 (2018-11-09) |
parents | ea729e0cf24d |
children | 96057ee68017 d4baf8a4b43a |
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 @@ -116,7 +116,7 @@ final public class MonetDriver implement { // url should be of style jdbc:monetdb://<host>/<database> if (!acceptsURL(url)) - throw new SQLNonTransientConnectionException("Invalid URL: it does not start with: " + MONETURL, "08M26"); + return null; Properties props = new Properties(); // set the optional properties and their defaults here @@ -134,12 +134,12 @@ final public class MonetDriver implement try { uri = new URI(url.substring(5)); } catch (URISyntaxException e) { - throw new SQLNonTransientConnectionException(e.toString(), "08M26"); + return null; } String uri_host = uri.getHost(); if (uri_host == null) - throw new SQLNonTransientConnectionException("Invalid URL: no hostname given or unparsable in '" + url + "'", "08M26"); + return null; info.put("host", uri_host); int uri_port = uri.getPort();