Class Configuration
- java.lang.Object
-
- org.mariadb.jdbc.Configuration
-
public class Configuration extends Object
parse and verification of URL.basic syntax :
jdbc:mariadb:[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:mariadb://[2001:0660:7401:0200:0000:0000:0edf:bdd7]:3306
Some examples :
jdbc:mariadb://localhost:3306/database?user=greg&password=pass
jdbc:mariadb://address=(type=master)(host=master1),address=(port=3307)(type=slave)(host=slave1)/database?user=greg&password=pass
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Configuration.Builder
A builder forConfiguration
instances.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
acceptsUrl(String url)
Tell if mariadb driver accept url string.List<HostAddress>
addresses()
addressesboolean
allowLocalInfile()
permits LOAD LOCAL INFILE commandsboolean
allowMultiQueries()
permit using multi queries commandboolean
allowPublicKeyRetrieval()
permit mysql authentication to retrieve server certificateBoolean
autocommit()
Force session autocommit on connection creationboolean
blankTableNameMeta()
force returning blank table metadata (for old oracle compatibility)protected static String
buildUrl(Configuration conf)
Generate initialURL propertyboolean
cachePrepStmts()
Cache prepared statement result.Configuration
clone(String username, String password)
Clone configuration with another user/passwordCodec<?>[]
codecs()
datatype Encoder/decoder listString
connectionAttributes()
Connections attributesint
connectTimeout()
socket connect timeoutConfiguration
connectTimeout(int connectTimeout)
Set connect timeoutboolean
createDatabaseIfNotExist()
create database if not existCredentialPlugin
credentialPlugin()
credential plugin to useString
database()
Connection default databaseint
defaultFetchSize()
result-set streaming default fetch sizeboolean
disablePipeline()
Disable pipeline.boolean
dumpQueriesOnException()
Must query by logged on exception.String
enabledSslCipherSuites()
autorized cipher list.String
enabledSslProtocolSuites()
permitted ssl protocol list (comma separated)boolean
equals(Object o)
String
galeraAllowedState()
Galera comma separated allowed stateString
geometryDefaultType()
geometry default decoding implementationHaMode
haMode()
High availability modeint
hashCode()
boolean
includeInnodbStatusInDeadlockExceptions()
On deadlock exception, must driver execute additional commands to show innodb status in error description.boolean
includeThreadDumpInDeadlockExceptions()
On deadlock exception, must driver display threads information on error description.String
initialUrl()
Configuration generated URL depending on current configuration option.String
initSql()
Execute initial command when connection is establishedString
keyPassword()
key store alias passwordString
keyStore()
key storeString
keyStorePassword()
key store passwordString
keyStoreType()
key store type (to replace default javax.net.ssl.keyStoreType system property)String
localSocket()
local socket configurationString
localSocketAddress()
local socket address pathInteger
maxAllowedPacket()
max_allowed_packet value to avoid sending packet with non supported size, droping the connection without reason.int
maxIdleTime()
Max idle timeint
maxPoolSize()
max pool sizeint
maxQuerySizeToLog()
query maximum size to log (query will be truncated of more than this limit)int
minPoolSize()
Minimum pool sizeProperties
nonMappedOptions()
non standard optionsstatic Configuration
parse(String url)
parse connection stringstatic Configuration
parse(String url, Properties prop)
Parse url connection string with additional properties.String
password()
configuration passwordString
pipe()
Pipe pathboolean
pool()
Create poolString
poolName()
pool nameint
poolValidMinDelay()
Pool mininum validation delay.int
prepStmtCacheSize()
Prepare statement cache size.boolean
registerJmxPool()
register pool information to JMXString
restrictedAuth()
Restrict authentication plugin to comma separated plugin listint
retriesAllDown()
retry the maximum retry number of attempts to reconnect after a failover.String
serverRsaPublicKeyFile()
Server RSA public key file for caching_sha2_password authenticationString
serverSslCert()
server ssl certificate (file path / certificat content)String
servicePrincipalName()
Service principal name (GSSAPI option)String
sessionVariables()
coma separated Session variable listString
socketFactory()
Socket factory class nameint
socketTimeout()
socket timeoutSslMode
sslMode()
SSl modeboolean
tcpAbortiveClose()
close using TCP abortive close (RST TCP packet, in place or FIN packet)boolean
tcpKeepAlive()
socket tcp keep aliveint
tcpKeepCount()
socket tcp keep count (java 11+ only)int
tcpKeepIdle()
socket tcp keep idle (java 11+ only)int
tcpKeepInterval()
socket tcp keep interval (java 11+ only)String
timezone()
Set timezoneboolean
tinyInt1isBit()
Must tinyint(1) be considered as BitString
tlsSocketType()
TLS socket typestatic String
toConf(String url)
Permit to have string information on how string is parsed.String
toString()
ToString implementation.TransactionIsolation
transactionIsolation()
Default transaction isolationboolean
transactionReplay()
implements transaction replay failoverint
transactionReplaySize()
transaction replay maximum number of saved command.boolean
transformedBitIsBoolean()
Must tinyint(1) be considered as Boolean or BitString
trustStoreType()
trust store type (to replace default javax.net.ssl.keyStoreType system property)boolean
useAffectedRows()
Use affected rowboolean
useBulkStmts()
Use server COM_STMT_BULK for batching.boolean
useBulkStmtsForInserts()
Use server COM_STMT_BULK for batching inserts.CatalogTerm
useCatalogTerm()
Indicating using Catalog or Schemaboolean
useCompression()
Enable compression if server has compression capabilityboolean
useLocalSessionState()
use local state to avoid unnecessary queries.boolean
useMysqlMetadata()
Force returning MySQL metadata informationString
user()
configuration userboolean
useReadAheadInput()
Read all data from socket in advanceboolean
useResetConnection()
Must connection returned to pool be RESETboolean
useServerPrepStmts()
Use server prepared statement.boolean
uuidAsString()
must uuid fields return as String and not java.util.UUIDboolean
yearIsDateType()
Must year be return by default as Date in result-set
-
-
-
Method Detail
-
acceptsUrl
public static boolean acceptsUrl(String url)
Tell if mariadb driver accept url string. (Correspond to interface java.jdbc.Driver.acceptsURL() method)- Parameters:
url
- url String- Returns:
- true if url string correspond.
-
parse
public static Configuration parse(String url) throws SQLException
parse connection string- Parameters:
url
- connection string- Returns:
- configuration resulting object
- Throws:
SQLException
- if not supported driver or wrong connection string format.
-
parse
public static Configuration parse(String url, Properties prop) throws SQLException
Parse url connection string with additional properties.- Parameters:
url
- connection stringprop
- properties- Returns:
- UrlParser instance
- Throws:
SQLException
- if parsing exception occur
-
toConf
public static String toConf(String url) throws SQLException
Permit to have string information on how string is parsed. example : Configuration.toConf("jdbc:mariadb://localhost/test") will return a String containing:Configuration: * resulting Url : jdbc:mariadb://localhost/test Unknown options : None Non default options : * database : test default options : * user : null ...
- Parameters:
url
- url string- Returns:
- string describing the configuration parsed from url
- Throws:
SQLException
- if parsing fails
-
buildUrl
protected static String buildUrl(Configuration conf)
Generate initialURL property- Parameters:
conf
- current configuration- Returns:
- initialUrl value.
-
clone
public Configuration clone(String username, String password)
Clone configuration with another user/password- Parameters:
username
- new usernamepassword
- new password- Returns:
- new cloned configuration object
-
database
public String database()
Connection default database- Returns:
- database
-
addresses
public List<HostAddress> addresses()
addresses- Returns:
- addresses
-
haMode
public HaMode haMode()
High availability mode- Returns:
- configuration HA mode
-
credentialPlugin
public CredentialPlugin credentialPlugin()
credential plugin to use- Returns:
- credential plugin to use, null of none
-
user
public String user()
configuration user- Returns:
- user
-
password
public String password()
configuration password- Returns:
- password
-
initialUrl
public String initialUrl()
Configuration generated URL depending on current configuration option. Password will be hidden by "***"- Returns:
- generated url
-
serverSslCert
public String serverSslCert()
server ssl certificate (file path / certificat content)- Returns:
- server ssl certificate
-
keyStore
public String keyStore()
key store- Returns:
- key store
-
keyStorePassword
public String keyStorePassword()
key store password- Returns:
- key store password
-
keyPassword
public String keyPassword()
key store alias password- Returns:
- key store alias password
-
keyStoreType
public String keyStoreType()
key store type (to replace default javax.net.ssl.keyStoreType system property)- Returns:
- key store type
-
trustStoreType
public String trustStoreType()
trust store type (to replace default javax.net.ssl.keyStoreType system property)- Returns:
- trust store type
-
enabledSslProtocolSuites
public String enabledSslProtocolSuites()
permitted ssl protocol list (comma separated)- Returns:
- enabled ssl protocol list
-
socketFactory
public String socketFactory()
Socket factory class name- Returns:
- socket factory
-
connectTimeout
public int connectTimeout()
socket connect timeout- Returns:
- connect timeout
-
connectTimeout
public Configuration connectTimeout(int connectTimeout)
Set connect timeout- Parameters:
connectTimeout
- timeout value- Returns:
- current configuration
-
pipe
public String pipe()
Pipe path- Returns:
- pipe value
-
localSocket
public String localSocket()
local socket configuration- Returns:
- local socket path
-
tcpKeepAlive
public boolean tcpKeepAlive()
socket tcp keep alive- Returns:
- socket tcp keep alive value
-
uuidAsString
public boolean uuidAsString()
must uuid fields return as String and not java.util.UUID- Returns:
- must UUID return as String and not uuid
-
tcpKeepIdle
public int tcpKeepIdle()
socket tcp keep idle (java 11+ only)- Returns:
- socket tcp keep idle
-
tcpKeepCount
public int tcpKeepCount()
socket tcp keep count (java 11+ only)- Returns:
- socket tcp keep count
-
tcpKeepInterval
public int tcpKeepInterval()
socket tcp keep interval (java 11+ only)- Returns:
- socket tcp keep interval
-
tcpAbortiveClose
public boolean tcpAbortiveClose()
close using TCP abortive close (RST TCP packet, in place or FIN packet)- Returns:
- close using TCP abortive close
-
localSocketAddress
public String localSocketAddress()
local socket address path- Returns:
- local socket address
-
socketTimeout
public int socketTimeout()
socket timeout- Returns:
- socket timeout
-
allowMultiQueries
public boolean allowMultiQueries()
permit using multi queries command- Returns:
- permit using multi queries command
-
allowLocalInfile
public boolean allowLocalInfile()
permits LOAD LOCAL INFILE commands- Returns:
- allow LOAD LOCAL INFILE
-
useCompression
public boolean useCompression()
Enable compression if server has compression capability- Returns:
- use compression
-
blankTableNameMeta
public boolean blankTableNameMeta()
force returning blank table metadata (for old oracle compatibility)- Returns:
- metadata table return blank
-
sslMode
public SslMode sslMode()
SSl mode- Returns:
- ssl mode
-
transactionIsolation
public TransactionIsolation transactionIsolation()
Default transaction isolation- Returns:
- default transaction isolation.
-
enabledSslCipherSuites
public String enabledSslCipherSuites()
autorized cipher list.- Returns:
- list of permitted ciphers
-
sessionVariables
public String sessionVariables()
coma separated Session variable list- Returns:
- session variable
-
tinyInt1isBit
public boolean tinyInt1isBit()
Must tinyint(1) be considered as Bit- Returns:
- true if tinyint(1) must be considered as Bit
-
transformedBitIsBoolean
public boolean transformedBitIsBoolean()
Must tinyint(1) be considered as Boolean or Bit- Returns:
- true if tinyint(1) must be considered as Boolean
-
yearIsDateType
public boolean yearIsDateType()
Must year be return by default as Date in result-set- Returns:
- year is Date type
-
timezone
public String timezone()
Set timezone- Returns:
- timezone
-
dumpQueriesOnException
public boolean dumpQueriesOnException()
Must query by logged on exception.- Returns:
- dump queries on exception
-
prepStmtCacheSize
public int prepStmtCacheSize()
Prepare statement cache size.- Returns:
- Prepare statement cache size
-
useAffectedRows
public boolean useAffectedRows()
Use affected row- Returns:
- use affected rows
-
useServerPrepStmts
public boolean useServerPrepStmts()
Use server prepared statement. IF false, using client prepared statement.- Returns:
- use server prepared statement
-
connectionAttributes
public String connectionAttributes()
Connections attributes- Returns:
- connection meta informations
-
useBulkStmts
public boolean useBulkStmts()
Use server COM_STMT_BULK for batching.- Returns:
- use server bulk command.
-
useBulkStmtsForInserts
public boolean useBulkStmtsForInserts()
Use server COM_STMT_BULK for batching inserts. if useBulkStmts is enabled, useBulkStmtsForInserts will be as well- Returns:
- use server bulk command for inserts
-
disablePipeline
public boolean disablePipeline()
Disable pipeline.- Returns:
- is pipeline disabled.
-
autocommit
public Boolean autocommit()
Force session autocommit on connection creation- Returns:
- autocommit forced value
-
useMysqlMetadata
public boolean useMysqlMetadata()
Force returning MySQL metadata information- Returns:
- force returning MySQL in metadata
-
useCatalogTerm
public CatalogTerm useCatalogTerm()
Indicating using Catalog or Schema- Returns:
- Indicating using Catalog or Schema
-
createDatabaseIfNotExist
public boolean createDatabaseIfNotExist()
create database if not exist- Returns:
- create database if not exist
-
useLocalSessionState
public boolean useLocalSessionState()
use local state to avoid unnecessary queries. This means application must use JDBC dedicated methods, like connection.setTransactionIsolation and never queries like "SET SESSION TRANSACTION ISOLATION LEVEL X" directly- Returns:
- can use local state
-
includeInnodbStatusInDeadlockExceptions
public boolean includeInnodbStatusInDeadlockExceptions()
On deadlock exception, must driver execute additional commands to show innodb status in error description.- Returns:
- includeInnodbStatusInDeadlockExceptions
-
includeThreadDumpInDeadlockExceptions
public boolean includeThreadDumpInDeadlockExceptions()
On deadlock exception, must driver display threads information on error description.- Returns:
- include Thread Dump In Deadlock Exceptions
-
servicePrincipalName
public String servicePrincipalName()
Service principal name (GSSAPI option)- Returns:
- service principal name
-
defaultFetchSize
public int defaultFetchSize()
result-set streaming default fetch size- Returns:
- Default fetch size.
-
nonMappedOptions
public Properties nonMappedOptions()
non standard options- Returns:
- non standard options
-
tlsSocketType
public String tlsSocketType()
TLS socket type- Returns:
- TLS socket type
-
maxQuerySizeToLog
public int maxQuerySizeToLog()
query maximum size to log (query will be truncated of more than this limit)- Returns:
- max query log size
-
maxAllowedPacket
public Integer maxAllowedPacket()
max_allowed_packet value to avoid sending packet with non supported size, droping the connection without reason.- Returns:
- max_allowed_packet value
-
retriesAllDown
public int retriesAllDown()
retry the maximum retry number of attempts to reconnect after a failover.- Returns:
- the maximum retry number of attempts to reconnect after a failover.
-
galeraAllowedState
public String galeraAllowedState()
Galera comma separated allowed state- Returns:
- galera allowed state
-
pool
public boolean pool()
Create pool- Returns:
- create pool if don't exists
-
poolName
public String poolName()
pool name- Returns:
- pool name.
-
maxPoolSize
public int maxPoolSize()
max pool size- Returns:
- maximum pool size
-
minPoolSize
public int minPoolSize()
Minimum pool size- Returns:
- minimum pool size
-
maxIdleTime
public int maxIdleTime()
Max idle time- Returns:
- pool max idle time.
-
registerJmxPool
public boolean registerJmxPool()
register pool information to JMX- Returns:
- register pool to JMX
-
poolValidMinDelay
public int poolValidMinDelay()
Pool mininum validation delay.- Returns:
- pool validation delay
-
useResetConnection
public boolean useResetConnection()
Must connection returned to pool be RESET- Returns:
- use RESET on connection
-
serverRsaPublicKeyFile
public String serverRsaPublicKeyFile()
Server RSA public key file for caching_sha2_password authentication- Returns:
- server key file
-
allowPublicKeyRetrieval
public boolean allowPublicKeyRetrieval()
permit mysql authentication to retrieve server certificate- Returns:
- is driver allowed to retrieve server certificate from server
-
useReadAheadInput
public boolean useReadAheadInput()
Read all data from socket in advance- Returns:
- use read ahead buffer implementation
-
cachePrepStmts
public boolean cachePrepStmts()
Cache prepared statement result.- Returns:
- cache prepare results
-
transactionReplay
public boolean transactionReplay()
implements transaction replay failover- Returns:
- true if transaction must be replayed on failover.
-
transactionReplaySize
public int transactionReplaySize()
transaction replay maximum number of saved command.- Returns:
- transaction replay buffer size.
-
geometryDefaultType
public String geometryDefaultType()
geometry default decoding implementation- Returns:
- geometry default type
-
restrictedAuth
public String restrictedAuth()
Restrict authentication plugin to comma separated plugin list- Returns:
- authorized authentication list
-
initSql
public String initSql()
Execute initial command when connection is established- Returns:
- initial SQL command
-
codecs
public Codec<?>[] codecs()
datatype Encoder/decoder list- Returns:
- codec list
-
toString
public String toString()
ToString implementation.
-
-