Class Configuration
- java.lang.Object
-
- org.mariadb.jdbc.Configuration
-
public class Configuration extends java.lang.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.
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<HostAddress>
addresses
private boolean
allowLocalInfile
private boolean
allowMultiQueries
private boolean
allowPublicKeyRetrieval
private java.lang.Boolean
autocommit
private boolean
blankTableNameMeta
private boolean
cachePrepStmts
private Codec<?>[]
codecs
private java.lang.String
connectionAttributes
private java.lang.String
connectionCollation
private java.lang.String
connectionTimeZone
private int
connectTimeout
private boolean
createDatabaseIfNotExist
private CredentialPlugin
credentialType
private java.lang.String
database
private int
defaultFetchSize
private boolean
disablePipeline
private boolean
dumpQueriesOnException
private java.lang.String
enabledSslCipherSuites
private java.lang.String
enabledSslProtocolSuites
private boolean
fallbackToSystemKeyStore
private boolean
fallbackToSystemTrustStore
private java.lang.Boolean
forceConnectionTimeZoneToSession
private java.lang.String
galeraAllowedState
private java.lang.String
geometryDefaultType
private HaMode
haMode
private boolean
includeInnodbStatusInDeadlockExceptions
private boolean
includeThreadDumpInDeadlockExceptions
private java.lang.String
initialUrl
private java.lang.String
initSql
private boolean
jdbcCompliantTruncation
private java.lang.String
keyPassword
private java.lang.String
keyStore
private java.lang.String
keyStorePassword
private java.lang.String
keyStoreType
private java.lang.String
localSocket
private java.lang.String
localSocketAddress
private static Logger
logger
private java.lang.Integer
maxAllowedPacket
private int
maxIdleTime
private int
maxPoolSize
private int
maxQuerySizeToLog
private int
minPoolSize
private java.util.Properties
nonMappedOptions
private boolean
nullDatabaseMeansCurrent
private java.lang.String
password
private boolean
permitRedirect
private boolean
pinGlobalTxToPhysicalConnection
private java.lang.String
pipe
private boolean
pool
private java.lang.String
poolName
private int
poolValidMinDelay
private int
prepStmtCacheSize
private boolean
preserveInstants
private boolean
registerJmxPool
private java.lang.String
restrictedAuth
private int
retriesAllDown
private boolean
returnMultiValuesGeneratedIds
private java.lang.String
serverRsaPublicKeyFile
private java.lang.String
serverSslCert
private java.lang.String
servicePrincipalName
private java.lang.String
sessionVariables
private java.lang.String
socketFactory
private int
socketTimeout
private SslMode
sslMode
private boolean
tcpAbortiveClose
private boolean
tcpKeepAlive
private int
tcpKeepCount
private int
tcpKeepIdle
private int
tcpKeepInterval
private java.lang.String
timezone
private boolean
tinyInt1isBit
private java.lang.String
tlsSocketType
private TransactionIsolation
transactionIsolation
private boolean
transactionReplay
private int
transactionReplaySize
private boolean
transformedBitIsBoolean
private java.lang.String
trustStore
private java.lang.String
trustStorePassword
private java.lang.String
trustStoreType
private boolean
useAffectedRows
private boolean
useBulkStmts
private boolean
useBulkStmtsForInserts
private CatalogTerm
useCatalogTerm
private boolean
useCompression
private boolean
useLocalSessionState
private boolean
useMysqlMetadata
private java.lang.String
user
private boolean
useReadAheadInput
private boolean
useResetConnection
private boolean
useServerPrepStmts
private boolean
uuidAsString
private boolean
yearIsDateType
-
Constructor Summary
Constructors Modifier Constructor Description private
Configuration()
private
Configuration(java.lang.String user, java.lang.String password, java.lang.String database, java.util.List<HostAddress> addresses, HaMode haMode, java.util.Properties nonMappedOptions, java.lang.String timezone, java.lang.String connectionTimeZone, java.lang.String connectionCollation, boolean forceConnectionTimeZoneToSession, boolean preserveInstants, java.lang.Boolean autocommit, boolean useMysqlMetadata, boolean nullDatabaseMeansCurrent, CatalogTerm useCatalogTerm, boolean createDatabaseIfNotExist, boolean useLocalSessionState, boolean returnMultiValuesGeneratedIds, boolean jdbcCompliantTruncation, boolean permitRedirect, boolean pinGlobalTxToPhysicalConnection, TransactionIsolation transactionIsolation, int defaultFetchSize, int maxQuerySizeToLog, java.lang.Integer maxAllowedPacket, java.lang.String geometryDefaultType, java.lang.String restrictedAuth, java.lang.String initSql, java.lang.String socketFactory, int connectTimeout, java.lang.String pipe, java.lang.String localSocket, boolean tcpKeepAlive, boolean uuidAsString, int tcpKeepIdle, int tcpKeepCount, int tcpKeepInterval, boolean tcpAbortiveClose, java.lang.String localSocketAddress, int socketTimeout, boolean useReadAheadInput, java.lang.String tlsSocketType, SslMode sslMode, java.lang.String serverSslCert, java.lang.String keyStore, java.lang.String trustStore, java.lang.String keyStorePassword, java.lang.String trustStorePassword, java.lang.String keyPassword, java.lang.String keyStoreType, java.lang.String trustStoreType, java.lang.String enabledSslCipherSuites, java.lang.String enabledSslProtocolSuites, boolean fallbackToSystemKeyStore, boolean fallbackToSystemTrustStore, boolean allowMultiQueries, boolean allowLocalInfile, boolean useCompression, boolean useAffectedRows, boolean useBulkStmts, boolean useBulkStmtsForInserts, boolean disablePipeline, boolean cachePrepStmts, int prepStmtCacheSize, boolean useServerPrepStmts, CredentialPlugin credentialType, java.lang.String sessionVariables, java.lang.String connectionAttributes, java.lang.String servicePrincipalName, boolean blankTableNameMeta, boolean tinyInt1isBit, boolean transformedBitIsBoolean, boolean yearIsDateType, boolean dumpQueriesOnException, boolean includeInnodbStatusInDeadlockExceptions, boolean includeThreadDumpInDeadlockExceptions, int retriesAllDown, java.lang.String galeraAllowedState, boolean transactionReplay, int transactionReplaySize, boolean pool, java.lang.String poolName, int maxPoolSize, int minPoolSize, int maxIdleTime, boolean registerJmxPool, int poolValidMinDelay, boolean useResetConnection, java.lang.String serverRsaPublicKeyFile, boolean allowPublicKeyRetrieval)
private
Configuration(java.lang.String database, java.util.List<HostAddress> addresses, HaMode haMode, java.lang.String user, java.lang.String password, java.lang.String enabledSslProtocolSuites, java.lang.Boolean fallbackToSystemKeyStore, java.lang.Boolean fallbackToSystemTrustStore, java.lang.String socketFactory, java.lang.Integer connectTimeout, java.lang.String pipe, java.lang.String localSocket, java.lang.Boolean tcpKeepAlive, java.lang.Boolean uuidAsString, java.lang.Integer tcpKeepIdle, java.lang.Integer tcpKeepCount, java.lang.Integer tcpKeepInterval, java.lang.Boolean tcpAbortiveClose, java.lang.String localSocketAddress, java.lang.Integer socketTimeout, java.lang.Boolean allowMultiQueries, java.lang.Boolean allowLocalInfile, java.lang.Boolean useCompression, java.lang.Boolean blankTableNameMeta, java.lang.String credentialType, java.lang.String sslMode, java.lang.String transactionIsolation, java.lang.String enabledSslCipherSuites, java.lang.String sessionVariables, java.lang.Boolean tinyInt1isBit, java.lang.Boolean transformedBitIsBoolean, java.lang.Boolean yearIsDateType, java.lang.String timezone, java.lang.String connectionTimeZone, java.lang.String connectionCollation, java.lang.Boolean forceConnectionTimeZoneToSession, java.lang.Boolean preserveInstants, java.lang.Boolean dumpQueriesOnException, java.lang.Integer prepStmtCacheSize, java.lang.Boolean useAffectedRows, java.lang.Boolean useServerPrepStmts, java.lang.String connectionAttributes, java.lang.Boolean useBulkStmts, java.lang.Boolean useBulkStmtsForInserts, java.lang.Boolean disablePipeline, java.lang.Boolean autocommit, java.lang.Boolean useMysqlMetadata, java.lang.Boolean nullDatabaseMeansCurrent, java.lang.String useCatalogTerm, java.lang.Boolean createDatabaseIfNotExist, java.lang.Boolean useLocalSessionState, java.lang.Boolean returnMultiValuesGeneratedIds, java.lang.Boolean jdbcCompliantTruncation, java.lang.Boolean permitRedirect, java.lang.Boolean pinGlobalTxToPhysicalConnection, java.lang.Boolean includeInnodbStatusInDeadlockExceptions, java.lang.Boolean includeThreadDumpInDeadlockExceptions, java.lang.String servicePrincipalName, java.lang.Integer defaultFetchSize, java.lang.String tlsSocketType, java.lang.Integer maxQuerySizeToLog, java.lang.Integer maxAllowedPacket, java.lang.Integer retriesAllDown, java.lang.String galeraAllowedState, java.lang.Boolean pool, java.lang.String poolName, java.lang.Integer maxPoolSize, java.lang.Integer minPoolSize, java.lang.Integer maxIdleTime, java.lang.Boolean registerJmxPool, java.lang.Integer poolValidMinDelay, java.lang.Boolean useResetConnection, java.lang.String serverRsaPublicKeyFile, java.lang.Boolean allowPublicKeyRetrieval, java.lang.String serverSslCert, java.lang.String keyStore, java.lang.String trustStore, java.lang.String keyStorePassword, java.lang.String trustStorePassword, java.lang.String keyPassword, java.lang.String keyStoreType, java.lang.String trustStoreType, java.lang.Boolean useReadAheadInput, java.lang.Boolean cachePrepStmts, java.lang.Boolean transactionReplay, java.lang.Integer transactionReplaySize, java.lang.String geometryDefaultType, java.lang.String restrictedAuth, java.lang.String initSql, java.util.Properties nonMappedOptions)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
acceptsUrl(java.lang.String url)
Tell if mariadb driver accept url string.java.util.List<HostAddress>
addresses()
addressesboolean
allowLocalInfile()
permits LOAD LOCAL INFILE commandsboolean
allowMultiQueries()
permit using multi queries commandboolean
allowPublicKeyRetrieval()
permit mysql authentication to retrieve server certificatejava.lang.Boolean
autocommit()
Force session autocommit on connection creationboolean
blankTableNameMeta()
force returning blank table metadata (for old oracle compatibility)protected static java.lang.String
buildUrl(Configuration conf)
Generate initialURL propertyboolean
cachePrepStmts()
Cache prepared statement result.Configuration
clone(java.lang.String username, java.lang.String password)
Clone configuration with another user/passwordCodec<?>[]
codecs()
datatype Encoder/decoder listjava.lang.String
connectionAttributes()
Connections attributesjava.lang.String
connectionCollation()
get connectionCollationjava.lang.String
connectionTimeZone()
Set connectionTimeZoneint
connectTimeout()
socket connect timeoutConfiguration
connectTimeout(int connectTimeout)
Set connect timeoutboolean
createDatabaseIfNotExist()
create database if not existCredentialPlugin
credentialPlugin()
credential plugin to usejava.lang.String
database()
Connection default databaseint
defaultFetchSize()
result-set streaming default fetch sizeboolean
disablePipeline()
Disable pipeline.boolean
dumpQueriesOnException()
Must query by logged on exception.java.lang.String
enabledSslCipherSuites()
autorized cipher list.java.lang.String
enabledSslProtocolSuites()
permitted ssl protocol list (comma separated)boolean
equals(java.lang.Object o)
boolean
fallbackToSystemKeyStore()
Indicate if keyStore option is not set to use keystore system property like "javax.net.ssl.keyStore"boolean
fallbackToSystemTrustStore()
Indicate if system default truststore implementation can be usedjava.lang.Boolean
forceConnectionTimeZoneToSession()
forceConnectionTimeZoneToSession must connection timezone be forcedjava.lang.String
galeraAllowedState()
Galera comma separated allowed statejava.lang.String
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.java.lang.String
initialUrl()
Configuration generated URL depending on current configuration option.java.lang.String
initSql()
Execute initial command when connection is establishedprivate static boolean
isSet(java.lang.String key, java.util.Properties nonMappedOptions)
boolean
jdbcCompliantTruncation()
Force sql_mode to strict mode for JDBC compliancejava.lang.String
keyPassword()
key store alias passwordjava.lang.String
keyStore()
key storejava.lang.String
keyStorePassword()
key store passwordjava.lang.String
keyStoreType()
key store type (to replace default javax.net.ssl.keyStoreType system property)private void
loadCodecs()
java.lang.String
localSocket()
local socket configurationjava.lang.String
localSocketAddress()
local socket address pathprivate static void
mapPropertiesToOption(Configuration.Builder builder, java.util.Properties properties)
java.lang.Integer
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 sizejava.util.Properties
nonMappedOptions()
non standard optionsboolean
nullDatabaseMeansCurrent()
When enable, in DatabaseMetadata, will handle null database/schema (depending on UseCatalog=catalog/schema) as currentprivate static java.lang.String
nullOrEmpty(java.lang.String val)
static Configuration
parse(java.lang.String url)
parse connection stringstatic Configuration
parse(java.lang.String url, java.util.Properties prop)
Parse url connection string with additional properties.private static HaMode
parseHaMode(java.lang.String url, int separator)
private static Configuration
parseInternal(java.lang.String url, java.util.Properties properties)
Parses the connection URL in order to set the UrlParser instance with all the information provided through the URL.java.lang.String
password()
configuration passwordboolean
permitRedirect()
must client redirect when requiredboolean
pinGlobalTxToPhysicalConnection()
When enabled, ensure that for XA operation to use the same connectionjava.lang.String
pipe()
Pipe pathboolean
pool()
Create pooljava.lang.String
poolName()
pool nameint
poolValidMinDelay()
Pool mininum validation delay.int
prepStmtCacheSize()
Prepare statement cache size.boolean
preserveInstants()
Must timezone change preserve instantsboolean
registerJmxPool()
register pool information to JMXjava.lang.String
restrictedAuth()
Restrict authentication plugin to comma separated plugin listint
retriesAllDown()
retry the maximum retry number of attempts to reconnect after a failover.boolean
returnMultiValuesGeneratedIds()
Returns multi-values generated ids.java.lang.String
serverRsaPublicKeyFile()
Server RSA public key file for caching_sha2_password authenticationjava.lang.String
serverSslCert()
server ssl certificate (file path / certificat content)java.lang.String
servicePrincipalName()
Service principal name (GSSAPI option)java.lang.String
sessionVariables()
coma separated Session variable listjava.lang.String
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)java.lang.String
timezone()
Set timezoneboolean
tinyInt1isBit()
Must tinyint(1) be considered as Bitjava.lang.String
tlsSocketType()
TLS socket typeConfiguration.Builder
toBuilder()
Create a Builder from current configuration.static java.lang.String
toConf(java.lang.String url)
Permit to have string information on how string is parsed.java.lang.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 Bitjava.lang.String
trustStore()
trust storejava.lang.String
trustStorePassword()
trust store passwordjava.lang.String
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 informationjava.lang.String
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
-
-
-
Field Detail
-
logger
private static final Logger logger
-
user
private java.lang.String user
-
password
private java.lang.String password
-
database
private java.lang.String database
-
addresses
private java.util.List<HostAddress> addresses
-
haMode
private HaMode haMode
-
initialUrl
private java.lang.String initialUrl
-
nonMappedOptions
private java.util.Properties nonMappedOptions
-
timezone
private java.lang.String timezone
-
connectionCollation
private java.lang.String connectionCollation
-
connectionTimeZone
private java.lang.String connectionTimeZone
-
forceConnectionTimeZoneToSession
private java.lang.Boolean forceConnectionTimeZoneToSession
-
preserveInstants
private boolean preserveInstants
-
autocommit
private java.lang.Boolean autocommit
-
useMysqlMetadata
private boolean useMysqlMetadata
-
nullDatabaseMeansCurrent
private boolean nullDatabaseMeansCurrent
-
useCatalogTerm
private CatalogTerm useCatalogTerm
-
createDatabaseIfNotExist
private boolean createDatabaseIfNotExist
-
useLocalSessionState
private boolean useLocalSessionState
-
returnMultiValuesGeneratedIds
private boolean returnMultiValuesGeneratedIds
-
jdbcCompliantTruncation
private boolean jdbcCompliantTruncation
-
permitRedirect
private boolean permitRedirect
-
transactionIsolation
private TransactionIsolation transactionIsolation
-
defaultFetchSize
private int defaultFetchSize
-
maxQuerySizeToLog
private int maxQuerySizeToLog
-
maxAllowedPacket
private java.lang.Integer maxAllowedPacket
-
geometryDefaultType
private java.lang.String geometryDefaultType
-
restrictedAuth
private java.lang.String restrictedAuth
-
initSql
private java.lang.String initSql
-
pinGlobalTxToPhysicalConnection
private boolean pinGlobalTxToPhysicalConnection
-
socketFactory
private java.lang.String socketFactory
-
connectTimeout
private int connectTimeout
-
pipe
private java.lang.String pipe
-
localSocket
private java.lang.String localSocket
-
uuidAsString
private boolean uuidAsString
-
tcpKeepAlive
private boolean tcpKeepAlive
-
tcpKeepIdle
private int tcpKeepIdle
-
tcpKeepCount
private int tcpKeepCount
-
tcpKeepInterval
private int tcpKeepInterval
-
tcpAbortiveClose
private boolean tcpAbortiveClose
-
localSocketAddress
private java.lang.String localSocketAddress
-
socketTimeout
private int socketTimeout
-
useReadAheadInput
private boolean useReadAheadInput
-
tlsSocketType
private java.lang.String tlsSocketType
-
sslMode
private SslMode sslMode
-
serverSslCert
private java.lang.String serverSslCert
-
keyStore
private java.lang.String keyStore
-
trustStore
private java.lang.String trustStore
-
keyStorePassword
private java.lang.String keyStorePassword
-
trustStorePassword
private java.lang.String trustStorePassword
-
keyPassword
private java.lang.String keyPassword
-
keyStoreType
private java.lang.String keyStoreType
-
trustStoreType
private java.lang.String trustStoreType
-
enabledSslCipherSuites
private java.lang.String enabledSslCipherSuites
-
enabledSslProtocolSuites
private java.lang.String enabledSslProtocolSuites
-
fallbackToSystemKeyStore
private boolean fallbackToSystemKeyStore
-
fallbackToSystemTrustStore
private boolean fallbackToSystemTrustStore
-
allowMultiQueries
private boolean allowMultiQueries
-
allowLocalInfile
private boolean allowLocalInfile
-
useCompression
private boolean useCompression
-
useAffectedRows
private boolean useAffectedRows
-
useBulkStmts
private boolean useBulkStmts
-
useBulkStmtsForInserts
private boolean useBulkStmtsForInserts
-
disablePipeline
private boolean disablePipeline
-
cachePrepStmts
private boolean cachePrepStmts
-
prepStmtCacheSize
private int prepStmtCacheSize
-
useServerPrepStmts
private boolean useServerPrepStmts
-
credentialType
private CredentialPlugin credentialType
-
sessionVariables
private java.lang.String sessionVariables
-
connectionAttributes
private java.lang.String connectionAttributes
-
servicePrincipalName
private java.lang.String servicePrincipalName
-
blankTableNameMeta
private boolean blankTableNameMeta
-
tinyInt1isBit
private boolean tinyInt1isBit
-
transformedBitIsBoolean
private boolean transformedBitIsBoolean
-
yearIsDateType
private boolean yearIsDateType
-
dumpQueriesOnException
private boolean dumpQueriesOnException
-
includeInnodbStatusInDeadlockExceptions
private boolean includeInnodbStatusInDeadlockExceptions
-
includeThreadDumpInDeadlockExceptions
private boolean includeThreadDumpInDeadlockExceptions
-
retriesAllDown
private int retriesAllDown
-
galeraAllowedState
private java.lang.String galeraAllowedState
-
transactionReplay
private boolean transactionReplay
-
transactionReplaySize
private int transactionReplaySize
-
pool
private boolean pool
-
poolName
private java.lang.String poolName
-
maxPoolSize
private int maxPoolSize
-
minPoolSize
private int minPoolSize
-
maxIdleTime
private int maxIdleTime
-
registerJmxPool
private boolean registerJmxPool
-
poolValidMinDelay
private int poolValidMinDelay
-
useResetConnection
private boolean useResetConnection
-
serverRsaPublicKeyFile
private java.lang.String serverRsaPublicKeyFile
-
allowPublicKeyRetrieval
private boolean allowPublicKeyRetrieval
-
codecs
private Codec<?>[] codecs
-
-
Constructor Detail
-
Configuration
private Configuration()
-
Configuration
private Configuration(java.lang.String user, java.lang.String password, java.lang.String database, java.util.List<HostAddress> addresses, HaMode haMode, java.util.Properties nonMappedOptions, java.lang.String timezone, java.lang.String connectionTimeZone, java.lang.String connectionCollation, boolean forceConnectionTimeZoneToSession, boolean preserveInstants, java.lang.Boolean autocommit, boolean useMysqlMetadata, boolean nullDatabaseMeansCurrent, CatalogTerm useCatalogTerm, boolean createDatabaseIfNotExist, boolean useLocalSessionState, boolean returnMultiValuesGeneratedIds, boolean jdbcCompliantTruncation, boolean permitRedirect, boolean pinGlobalTxToPhysicalConnection, TransactionIsolation transactionIsolation, int defaultFetchSize, int maxQuerySizeToLog, java.lang.Integer maxAllowedPacket, java.lang.String geometryDefaultType, java.lang.String restrictedAuth, java.lang.String initSql, java.lang.String socketFactory, int connectTimeout, java.lang.String pipe, java.lang.String localSocket, boolean tcpKeepAlive, boolean uuidAsString, int tcpKeepIdle, int tcpKeepCount, int tcpKeepInterval, boolean tcpAbortiveClose, java.lang.String localSocketAddress, int socketTimeout, boolean useReadAheadInput, java.lang.String tlsSocketType, SslMode sslMode, java.lang.String serverSslCert, java.lang.String keyStore, java.lang.String trustStore, java.lang.String keyStorePassword, java.lang.String trustStorePassword, java.lang.String keyPassword, java.lang.String keyStoreType, java.lang.String trustStoreType, java.lang.String enabledSslCipherSuites, java.lang.String enabledSslProtocolSuites, boolean fallbackToSystemKeyStore, boolean fallbackToSystemTrustStore, boolean allowMultiQueries, boolean allowLocalInfile, boolean useCompression, boolean useAffectedRows, boolean useBulkStmts, boolean useBulkStmtsForInserts, boolean disablePipeline, boolean cachePrepStmts, int prepStmtCacheSize, boolean useServerPrepStmts, CredentialPlugin credentialType, java.lang.String sessionVariables, java.lang.String connectionAttributes, java.lang.String servicePrincipalName, boolean blankTableNameMeta, boolean tinyInt1isBit, boolean transformedBitIsBoolean, boolean yearIsDateType, boolean dumpQueriesOnException, boolean includeInnodbStatusInDeadlockExceptions, boolean includeThreadDumpInDeadlockExceptions, int retriesAllDown, java.lang.String galeraAllowedState, boolean transactionReplay, int transactionReplaySize, boolean pool, java.lang.String poolName, int maxPoolSize, int minPoolSize, int maxIdleTime, boolean registerJmxPool, int poolValidMinDelay, boolean useResetConnection, java.lang.String serverRsaPublicKeyFile, boolean allowPublicKeyRetrieval)
-
Configuration
private Configuration(java.lang.String database, java.util.List<HostAddress> addresses, HaMode haMode, java.lang.String user, java.lang.String password, java.lang.String enabledSslProtocolSuites, java.lang.Boolean fallbackToSystemKeyStore, java.lang.Boolean fallbackToSystemTrustStore, java.lang.String socketFactory, java.lang.Integer connectTimeout, java.lang.String pipe, java.lang.String localSocket, java.lang.Boolean tcpKeepAlive, java.lang.Boolean uuidAsString, java.lang.Integer tcpKeepIdle, java.lang.Integer tcpKeepCount, java.lang.Integer tcpKeepInterval, java.lang.Boolean tcpAbortiveClose, java.lang.String localSocketAddress, java.lang.Integer socketTimeout, java.lang.Boolean allowMultiQueries, java.lang.Boolean allowLocalInfile, java.lang.Boolean useCompression, java.lang.Boolean blankTableNameMeta, java.lang.String credentialType, java.lang.String sslMode, java.lang.String transactionIsolation, java.lang.String enabledSslCipherSuites, java.lang.String sessionVariables, java.lang.Boolean tinyInt1isBit, java.lang.Boolean transformedBitIsBoolean, java.lang.Boolean yearIsDateType, java.lang.String timezone, java.lang.String connectionTimeZone, java.lang.String connectionCollation, java.lang.Boolean forceConnectionTimeZoneToSession, java.lang.Boolean preserveInstants, java.lang.Boolean dumpQueriesOnException, java.lang.Integer prepStmtCacheSize, java.lang.Boolean useAffectedRows, java.lang.Boolean useServerPrepStmts, java.lang.String connectionAttributes, java.lang.Boolean useBulkStmts, java.lang.Boolean useBulkStmtsForInserts, java.lang.Boolean disablePipeline, java.lang.Boolean autocommit, java.lang.Boolean useMysqlMetadata, java.lang.Boolean nullDatabaseMeansCurrent, java.lang.String useCatalogTerm, java.lang.Boolean createDatabaseIfNotExist, java.lang.Boolean useLocalSessionState, java.lang.Boolean returnMultiValuesGeneratedIds, java.lang.Boolean jdbcCompliantTruncation, java.lang.Boolean permitRedirect, java.lang.Boolean pinGlobalTxToPhysicalConnection, java.lang.Boolean includeInnodbStatusInDeadlockExceptions, java.lang.Boolean includeThreadDumpInDeadlockExceptions, java.lang.String servicePrincipalName, java.lang.Integer defaultFetchSize, java.lang.String tlsSocketType, java.lang.Integer maxQuerySizeToLog, java.lang.Integer maxAllowedPacket, java.lang.Integer retriesAllDown, java.lang.String galeraAllowedState, java.lang.Boolean pool, java.lang.String poolName, java.lang.Integer maxPoolSize, java.lang.Integer minPoolSize, java.lang.Integer maxIdleTime, java.lang.Boolean registerJmxPool, java.lang.Integer poolValidMinDelay, java.lang.Boolean useResetConnection, java.lang.String serverRsaPublicKeyFile, java.lang.Boolean allowPublicKeyRetrieval, java.lang.String serverSslCert, java.lang.String keyStore, java.lang.String trustStore, java.lang.String keyStorePassword, java.lang.String trustStorePassword, java.lang.String keyPassword, java.lang.String keyStoreType, java.lang.String trustStoreType, java.lang.Boolean useReadAheadInput, java.lang.Boolean cachePrepStmts, java.lang.Boolean transactionReplay, java.lang.Integer transactionReplaySize, java.lang.String geometryDefaultType, java.lang.String restrictedAuth, java.lang.String initSql, java.util.Properties nonMappedOptions) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
-
Method Detail
-
toBuilder
public Configuration.Builder toBuilder()
Create a Builder from current configuration. Since configuration data are final, this permit to change configuration, creating another object.- Returns:
- builder
-
acceptsUrl
public static boolean acceptsUrl(java.lang.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(java.lang.String url) throws java.sql.SQLException
parse connection string- Parameters:
url
- connection string- Returns:
- configuration resulting object
- Throws:
java.sql.SQLException
- if not supported driver or wrong connection string format.
-
parse
public static Configuration parse(java.lang.String url, java.util.Properties prop) throws java.sql.SQLException
Parse url connection string with additional properties.- Parameters:
url
- connection stringprop
- properties- Returns:
- UrlParser instance
- Throws:
java.sql.SQLException
- if parsing exception occur
-
parseInternal
private static Configuration parseInternal(java.lang.String url, java.util.Properties properties) throws java.sql.SQLException
Parses the connection URL in order to set the UrlParser instance with all the information provided through the URL.- Parameters:
url
- connection URLproperties
- properties- Throws:
java.sql.SQLException
- if format is incorrect
-
mapPropertiesToOption
private static void mapPropertiesToOption(Configuration.Builder builder, java.util.Properties properties)
-
isSet
private static boolean isSet(java.lang.String key, java.util.Properties nonMappedOptions)
-
parseHaMode
private static HaMode parseHaMode(java.lang.String url, int separator)
-
toConf
public static java.lang.String toConf(java.lang.String url) throws java.sql.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:
java.sql.SQLException
- if parsing fails
-
buildUrl
protected static java.lang.String buildUrl(Configuration conf)
Generate initialURL property- Parameters:
conf
- current configuration- Returns:
- initialUrl value.
-
nullOrEmpty
private static java.lang.String nullOrEmpty(java.lang.String val)
-
clone
public Configuration clone(java.lang.String username, java.lang.String password)
Clone configuration with another user/password- Parameters:
username
- new usernamepassword
- new password- Returns:
- new cloned configuration object
-
database
public java.lang.String database()
Connection default database- Returns:
- database
-
addresses
public java.util.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 java.lang.String user()
configuration user- Returns:
- user
-
password
public java.lang.String password()
configuration password- Returns:
- password
-
initialUrl
public java.lang.String initialUrl()
Configuration generated URL depending on current configuration option. Password will be hidden by "***"- Returns:
- generated url
-
serverSslCert
public java.lang.String serverSslCert()
server ssl certificate (file path / certificat content)- Returns:
- server ssl certificate
-
keyStore
public java.lang.String keyStore()
key store- Returns:
- key store
-
trustStore
public java.lang.String trustStore()
trust store- Returns:
- trust store
-
keyStorePassword
public java.lang.String keyStorePassword()
key store password- Returns:
- key store password
-
trustStorePassword
public java.lang.String trustStorePassword()
trust store password- Returns:
- trust store password
-
keyPassword
public java.lang.String keyPassword()
key store alias password- Returns:
- key store alias password
-
keyStoreType
public java.lang.String keyStoreType()
key store type (to replace default javax.net.ssl.keyStoreType system property)- Returns:
- key store type
-
trustStoreType
public java.lang.String trustStoreType()
trust store type (to replace default javax.net.ssl.keyStoreType system property)- Returns:
- trust store type
-
enabledSslProtocolSuites
public java.lang.String enabledSslProtocolSuites()
permitted ssl protocol list (comma separated)- Returns:
- enabled ssl protocol list
-
fallbackToSystemKeyStore
public boolean fallbackToSystemKeyStore()
Indicate if keyStore option is not set to use keystore system property like "javax.net.ssl.keyStore"- Returns:
- true if can use keystore system property
-
fallbackToSystemTrustStore
public boolean fallbackToSystemTrustStore()
Indicate if system default truststore implementation can be used- Returns:
- true if system default truststore implementation can be used
-
socketFactory
public java.lang.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 java.lang.String pipe()
Pipe path- Returns:
- pipe value
-
localSocket
public java.lang.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 java.lang.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 java.lang.String enabledSslCipherSuites()
autorized cipher list.- Returns:
- list of permitted ciphers
-
sessionVariables
public java.lang.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 java.lang.String timezone()
Set timezone- Returns:
- timezone
-
connectionTimeZone
public java.lang.String connectionTimeZone()
Set connectionTimeZone- Returns:
- connectionTimeZone
-
connectionCollation
public java.lang.String connectionCollation()
get connectionCollation- Returns:
- connectionCollation
-
forceConnectionTimeZoneToSession
public java.lang.Boolean forceConnectionTimeZoneToSession()
forceConnectionTimeZoneToSession must connection timezone be forced- Returns:
- forceConnectionTimeZoneToSession
-
preserveInstants
public boolean preserveInstants()
Must timezone change preserve instants- Returns:
- true if instants must be preserved
-
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 java.lang.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 java.lang.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
-
nullDatabaseMeansCurrent
public boolean nullDatabaseMeansCurrent()
When enable, in DatabaseMetadata, will handle null database/schema (depending on UseCatalog=catalog/schema) as current- Returns:
- must null value be considered as current catalog/schema
-
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
-
returnMultiValuesGeneratedIds
public boolean returnMultiValuesGeneratedIds()
Returns multi-values generated ids. For mariadb 2.x connector compatibility- Returns:
- must returns multi-values generated ids.
-
jdbcCompliantTruncation
public boolean jdbcCompliantTruncation()
Force sql_mode to strict mode for JDBC compliance- Returns:
- must force jdbc compliance
-
permitRedirect
public boolean permitRedirect()
must client redirect when required- Returns:
- must client redirect when required
-
pinGlobalTxToPhysicalConnection
public boolean pinGlobalTxToPhysicalConnection()
When enabled, ensure that for XA operation to use the same connection- Returns:
- pinGlobalTxToPhysicalConnection
-
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 java.lang.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 java.util.Properties nonMappedOptions()
non standard options- Returns:
- non standard options
-
tlsSocketType
public java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.String geometryDefaultType()
geometry default decoding implementation- Returns:
- geometry default type
-
restrictedAuth
public java.lang.String restrictedAuth()
Restrict authentication plugin to comma separated plugin list- Returns:
- authorized authentication list
-
initSql
public java.lang.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 java.lang.String toString()
ToString implementation.- Overrides:
toString
in classjava.lang.Object
- Returns:
- String value
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
loadCodecs
private void loadCodecs()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-