Skip to content

Commit

Permalink
[CONJ-188] Default pool framework initialisation data
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Aug 31, 2015
1 parent 96a4d49 commit 0447a87
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
11 changes: 9 additions & 2 deletions src/main/java/org/mariadb/jdbc/JDBCUrl.java
Expand Up @@ -146,8 +146,15 @@ public static JDBCUrl parse(final String url, Properties prop) throws SQLExcepti
}

public void parseUrl(String url) throws SQLException {
if (!url.startsWith("jdbc:mysql:")) throw new IllegalArgumentException("Url must start with \"jdbc:mysql:\"");
parseInternal(this, url, new Properties());
if (url.startsWith("jdbc:mysql:")) {
parseInternal(this, url, new Properties());
}
String[] arr = new String[]{"jdbc:mysql:thin:", "jdbc:mariadb:"};
for (String prefix : arr) {
if (url.startsWith(prefix)) {
parseInternal(this, url, new Properties());
}
}
}

/*
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/org/mariadb/jdbc/MySQLDataSource.java
Expand Up @@ -194,7 +194,9 @@ public int getPort() {
* @see #setPort
*/
public void setPortNumber(int p) {
setPort(p);
if (p > 0) {
setPort(p);
}
}

/**
Expand All @@ -213,7 +215,9 @@ public int getPortNumber() {
* the server name
*/
public void setServerName(String serverName) {
jdbcUrl.getHostAddresses().get(0).host = serverName;
if (serverName != null && !serverName.isEmpty()) {
jdbcUrl.getHostAddresses().get(0).host = serverName;
}
}

public void setProperties(String properties) {
Expand Down

0 comments on commit 0447a87

Please sign in to comment.