public class UrlParser extends Object implements Cloneable
basic syntax :
jdbc:oceanbase:[replication:|failover|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:oceanbase://[2001:0660:7401:0200:0000:0000:0edf:bdd7]:3306
Some examples :
jdbc:oceanbase://localhost:3306/database?user=greg&password=pass
jdbc:oceanbase://address=(type=master)(host=master1),address=(port=3307)(type=slave)(host=slave1)/database?user=greg&password=pass
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
DBNAME_PROPERTY_KEY |
| 构造器和说明 |
|---|
UrlParser(String database,
List<HostAddress> addresses,
Options options,
HaMode haMode)
Constructor.
|
| 限定符和类型 | 方法和说明 |
|---|---|
static boolean |
acceptsUrl(String url)
Tell if mariadb driver accept url string.
|
UrlParser |
auroraPipelineQuirks()
Permit to set parameters not forced. if options useBatchMultiSend and usePipelineAuth are not
explicitly set in connection string, value will default to true or false according if aurora
detection.
|
Object |
clone() |
boolean |
equals(Object parser) |
String |
getConnectedUsername() |
CredentialPlugin |
getCredentialPlugin() |
String |
getDatabase() |
String |
getExtendDescription() |
HaMode |
getHaMode() |
List<HostAddress> |
getHostAddresses() |
String |
getInitialUrl() |
ConfigParser.OcpApi |
getOcpApi() |
Options |
getOptions() |
String |
getPassword() |
static String |
getPropertyDbName(Properties props) |
String |
getTnsServiceName() |
String |
getUsername() |
int |
hashCode() |
boolean |
isAurora()
Detection of Aurora.
|
boolean |
isMultiMaster() |
static UrlParser |
parse(String url) |
static UrlParser |
parse(String url,
Properties prop)
Parse url connection string with additional properties.
|
void |
parseUrl(String url)
Parse url connection string.
|
void |
setConnectedUsername(String connectedUsername) |
void |
setDatabase(String database) |
void |
setOcpApi(String urlPart) |
void |
setPassword(String password) |
protected void |
setProperties(String urlParameters) |
void |
setUsername(String username) |
String |
toString()
ToString implementation.
|
public UrlParser(String database, List<HostAddress> addresses, Options options, HaMode haMode) throws SQLException
database - databaseaddresses - list of hostsoptions - connection optionhaMode - High availability modeSQLException - if credential plugin cannot be loadedpublic static String getPropertyDbName(Properties props)
public static boolean acceptsUrl(String url)
url - url Stringpublic static UrlParser parse(String url) throws SQLException
SQLExceptionpublic static UrlParser parse(String url, Properties prop) throws SQLException
url - connection stringprop - propertiesSQLException - if parsing exception occurpublic UrlParser auroraPipelineQuirks()
public boolean isAurora()
Aurora rely on MySQL, then cannot be identified by protocol. But Aurora doesn't permit some behaviour normally working with MySQL : pipelining. So Driver must identified if server is Aurora to disable pipeline options that are enable by default.
public void parseUrl(String url) throws SQLException
url - connection stringSQLException - if url format is incorrectpublic String getUsername()
public void setUsername(String username)
public String getPassword()
public void setPassword(String password)
public String getDatabase()
public void setDatabase(String database)
public List<HostAddress> getHostAddresses()
public Options getOptions()
protected void setProperties(String urlParameters)
public CredentialPlugin getCredentialPlugin()
public String getInitialUrl()
public HaMode getHaMode()
public String getTnsServiceName()
public boolean isMultiMaster()
public Object clone() throws CloneNotSupportedException
clone 在类中 ObjectCloneNotSupportedExceptionpublic String getExtendDescription()
public ConfigParser.OcpApi getOcpApi()
public void setOcpApi(String urlPart)
public String getConnectedUsername()
public void setConnectedUsername(String connectedUsername)
Copyright © 2024 oceanbase.com. All rights reserved.