public class JDBCUrl extends Object
parse and verification of URL.
basic syntax :
jdbc:(mysql|mariadb):[replication:|loadbalance:|aurora:]//<hostDescription>[,<hostDescription>]/[database>][?<key1>=<value1>[&<key2>=<value2>]]
hostDescription:
- simple :
<host>:<portnumber>
(for example localhost:3306)
- complex :
address=[(type=(master|slave))][(port=<portnumber>)](host=<host>)
type is by default master
port is by default 3306
host can be dns name, ipv4 or ipv6.
in case of ipv6 and simple host description, the ip must be written inside bracket.
exemple : jdbc:mysql://[2001:0660:7401:0200:0000:0000:0edf:bdd7]:3306
Some examples :
jdbc:mysql://localhost:3306/database?user=greg&password=pass
jdbc:mysql://address=(type=master)(host=master1),address=(port=3307)(type=slave)(host=slave1)/database?user=greg&password=pass
| Modifier | Constructor and Description |
|---|---|
protected |
JDBCUrl(String database,
List<HostAddress> addresses,
Options options,
UrlHAMode haMode) |
| Modifier and Type | Method and Description |
|---|---|
String |
getDatabase() |
UrlHAMode |
getHaMode() |
List<HostAddress> |
getHostAddresses() |
Options |
getOptions() |
String |
getPassword() |
String |
getUsername() |
static JDBCUrl |
parse(String url) |
static JDBCUrl |
parse(String url,
Properties prop) |
void |
parseUrl(String url) |
protected void |
setDatabase(String database) |
protected void |
setPassword(String password) |
protected void |
setProperties(String urlParameters) |
protected void |
setUsername(String username) |
String |
toString() |
protected JDBCUrl(String database, List<HostAddress> addresses, Options options, UrlHAMode haMode)
public static JDBCUrl parse(String url, Properties prop)
public void parseUrl(String url)
public String getUsername()
public String getPassword()
public String getDatabase()
public List<HostAddress> getHostAddresses()
protected void setUsername(String username)
protected void setPassword(String password)
public Options getOptions()
protected void setDatabase(String database)
protected void setProperties(String urlParameters)
public UrlHAMode getHaMode()
Copyright © 2015. All rights reserved.