Class Configuration
- java.lang.Object
-
- org.mariadb.jdbc.Configuration
-
public class Configuration extends java.lang.Objectparse 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 classConfiguration.BuilderA builder forConfigurationinstances.
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<HostAddress>addressesprivate booleanallowLocalInfileprivate booleanallowMultiQueriesprivate booleanallowPublicKeyRetrievalprivate java.lang.Booleanautocommitprivate booleanblankTableNameMetaprivate booleancachePrepStmtsprivate Codec<?>[]codecsprivate java.lang.StringconnectionAttributesprivate java.lang.StringconnectionCollationprivate java.lang.StringconnectionTimeZoneprivate intconnectTimeoutprivate booleancreateDatabaseIfNotExistprivate CredentialPlugincredentialTypeprivate java.lang.Stringdatabaseprivate intdefaultFetchSizeprivate booleandisablePipelineprivate booleandumpQueriesOnExceptionprivate java.lang.StringenabledSslCipherSuitesprivate java.lang.StringenabledSslProtocolSuitesprivate booleanfallbackToSystemKeyStoreprivate booleanfallbackToSystemTrustStoreprivate java.lang.BooleanforceConnectionTimeZoneToSessionprivate java.lang.StringgaleraAllowedStateprivate java.lang.StringgeometryDefaultTypeprivate HaModehaModeprivate booleanincludeInnodbStatusInDeadlockExceptionsprivate booleanincludeThreadDumpInDeadlockExceptionsprivate java.lang.StringinitialUrlprivate java.lang.StringinitSqlprivate booleanjdbcCompliantTruncationprivate java.lang.StringkeyPasswordprivate java.lang.StringkeyStoreprivate java.lang.StringkeyStorePasswordprivate java.lang.StringkeyStoreTypeprivate java.lang.StringlocalSocketprivate java.lang.StringlocalSocketAddressprivate static Loggerloggerprivate java.lang.IntegermaxAllowedPacketprivate intmaxIdleTimeprivate intmaxPoolSizeprivate intmaxQuerySizeToLogprivate intminPoolSizeprivate java.util.PropertiesnonMappedOptionsprivate booleannullDatabaseMeansCurrentprivate java.lang.Stringpasswordprivate booleanpermitRedirectprivate booleanpinGlobalTxToPhysicalConnectionprivate java.lang.Stringpipeprivate booleanpoolprivate java.lang.StringpoolNameprivate intpoolValidMinDelayprivate intprepStmtCacheSizeprivate booleanpreserveInstantsprivate booleanregisterJmxPoolprivate java.lang.StringrestrictedAuthprivate intretriesAllDownprivate booleanreturnMultiValuesGeneratedIdsprivate java.lang.StringserverRsaPublicKeyFileprivate java.lang.StringserverSslCertprivate java.lang.StringservicePrincipalNameprivate java.lang.StringsessionVariablesprivate java.lang.StringsocketFactoryprivate intsocketTimeoutprivate SslModesslModeprivate booleantcpAbortiveCloseprivate booleantcpKeepAliveprivate inttcpKeepCountprivate inttcpKeepIdleprivate inttcpKeepIntervalprivate java.lang.Stringtimezoneprivate booleantinyInt1isBitprivate java.lang.StringtlsSocketTypeprivate TransactionIsolationtransactionIsolationprivate booleantransactionReplayprivate inttransactionReplaySizeprivate booleantransformedBitIsBooleanprivate java.lang.StringtrustStoreprivate java.lang.StringtrustStorePasswordprivate java.lang.StringtrustStoreTypeprivate booleanuseAffectedRowsprivate booleanuseBulkStmtsprivate booleanuseBulkStmtsForInsertsprivate CatalogTermuseCatalogTermprivate booleanuseCompressionprivate booleanuseLocalSessionStateprivate booleanuseMysqlMetadataprivate java.lang.Stringuserprivate booleanuseReadAheadInputprivate booleanuseResetConnectionprivate booleanuseServerPrepStmtsprivate booleanuuidAsStringprivate booleanyearIsDateType
-
Constructor Summary
Constructors Modifier Constructor Description privateConfiguration()privateConfiguration(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)privateConfiguration(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 booleanacceptsUrl(java.lang.String url)Tell if mariadb driver accept url string.java.util.List<HostAddress>addresses()addressesbooleanallowLocalInfile()permits LOAD LOCAL INFILE commandsbooleanallowMultiQueries()permit using multi queries commandbooleanallowPublicKeyRetrieval()permit mysql authentication to retrieve server certificatejava.lang.Booleanautocommit()Force session autocommit on connection creationbooleanblankTableNameMeta()force returning blank table metadata (for old oracle compatibility)protected static java.lang.StringbuildUrl(Configuration conf)Generate initialURL propertybooleancachePrepStmts()Cache prepared statement result.Configurationclone(java.lang.String username, java.lang.String password)Clone configuration with another user/passwordCodec<?>[]codecs()datatype Encoder/decoder listjava.lang.StringconnectionAttributes()Connections attributesjava.lang.StringconnectionCollation()get connectionCollationjava.lang.StringconnectionTimeZone()Set connectionTimeZoneintconnectTimeout()socket connect timeoutConfigurationconnectTimeout(int connectTimeout)Set connect timeoutbooleancreateDatabaseIfNotExist()create database if not existCredentialPlugincredentialPlugin()credential plugin to usejava.lang.Stringdatabase()Connection default databaseintdefaultFetchSize()result-set streaming default fetch sizebooleandisablePipeline()Disable pipeline.booleandumpQueriesOnException()Must query by logged on exception.java.lang.StringenabledSslCipherSuites()autorized cipher list.java.lang.StringenabledSslProtocolSuites()permitted ssl protocol list (comma separated)booleanequals(java.lang.Object o)booleanfallbackToSystemKeyStore()Indicate if keyStore option is not set to use keystore system property like "javax.net.ssl.keyStore"booleanfallbackToSystemTrustStore()Indicate if system default truststore implementation can be usedjava.lang.BooleanforceConnectionTimeZoneToSession()forceConnectionTimeZoneToSession must connection timezone be forcedjava.lang.StringgaleraAllowedState()Galera comma separated allowed statejava.lang.StringgeometryDefaultType()geometry default decoding implementationHaModehaMode()High availability modeinthashCode()booleanincludeInnodbStatusInDeadlockExceptions()On deadlock exception, must driver execute additional commands to show innodb status in error description.booleanincludeThreadDumpInDeadlockExceptions()On deadlock exception, must driver display threads information on error description.java.lang.StringinitialUrl()Configuration generated URL depending on current configuration option.java.lang.StringinitSql()Execute initial command when connection is establishedprivate static booleanisSet(java.lang.String key, java.util.Properties nonMappedOptions)booleanjdbcCompliantTruncation()Force sql_mode to strict mode for JDBC compliancejava.lang.StringkeyPassword()key store alias passwordjava.lang.StringkeyStore()key storejava.lang.StringkeyStorePassword()key store passwordjava.lang.StringkeyStoreType()key store type (to replace default javax.net.ssl.keyStoreType system property)private voidloadCodecs()java.lang.StringlocalSocket()local socket configurationjava.lang.StringlocalSocketAddress()local socket address pathprivate static voidmapPropertiesToOption(Configuration.Builder builder, java.util.Properties properties)java.lang.IntegermaxAllowedPacket()max_allowed_packet value to avoid sending packet with non supported size, droping the connection without reason.intmaxIdleTime()Max idle timeintmaxPoolSize()max pool sizeintmaxQuerySizeToLog()query maximum size to log (query will be truncated of more than this limit)intminPoolSize()Minimum pool sizejava.util.PropertiesnonMappedOptions()non standard optionsbooleannullDatabaseMeansCurrent()When enable, in DatabaseMetadata, will handle null database/schema (depending on UseCatalog=catalog/schema) as currentprivate static java.lang.StringnullOrEmpty(java.lang.String val)static Configurationparse(java.lang.String url)parse connection stringstatic Configurationparse(java.lang.String url, java.util.Properties prop)Parse url connection string with additional properties.private static HaModeparseHaMode(java.lang.String url, int separator)private static ConfigurationparseInternal(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.Stringpassword()configuration passwordbooleanpermitRedirect()must client redirect when requiredbooleanpinGlobalTxToPhysicalConnection()When enabled, ensure that for XA operation to use the same connectionjava.lang.Stringpipe()Pipe pathbooleanpool()Create pooljava.lang.StringpoolName()pool nameintpoolValidMinDelay()Pool mininum validation delay.intprepStmtCacheSize()Prepare statement cache size.booleanpreserveInstants()Must timezone change preserve instantsbooleanregisterJmxPool()register pool information to JMXjava.lang.StringrestrictedAuth()Restrict authentication plugin to comma separated plugin listintretriesAllDown()retry the maximum retry number of attempts to reconnect after a failover.booleanreturnMultiValuesGeneratedIds()Returns multi-values generated ids.java.lang.StringserverRsaPublicKeyFile()Server RSA public key file for caching_sha2_password authenticationjava.lang.StringserverSslCert()server ssl certificate (file path / certificat content)java.lang.StringservicePrincipalName()Service principal name (GSSAPI option)java.lang.StringsessionVariables()coma separated Session variable listjava.lang.StringsocketFactory()Socket factory class nameintsocketTimeout()socket timeoutSslModesslMode()SSl modebooleantcpAbortiveClose()close using TCP abortive close (RST TCP packet, in place or FIN packet)booleantcpKeepAlive()socket tcp keep aliveinttcpKeepCount()socket tcp keep count (java 11+ only)inttcpKeepIdle()socket tcp keep idle (java 11+ only)inttcpKeepInterval()socket tcp keep interval (java 11+ only)java.lang.Stringtimezone()Set timezonebooleantinyInt1isBit()Must tinyint(1) be considered as Bitjava.lang.StringtlsSocketType()TLS socket typeConfiguration.BuildertoBuilder()Create a Builder from current configuration.static java.lang.StringtoConf(java.lang.String url)Permit to have string information on how string is parsed.java.lang.StringtoString()ToString implementation.TransactionIsolationtransactionIsolation()Default transaction isolationbooleantransactionReplay()implements transaction replay failoverinttransactionReplaySize()transaction replay maximum number of saved command.booleantransformedBitIsBoolean()Must tinyint(1) be considered as Boolean or Bitjava.lang.StringtrustStore()trust storejava.lang.StringtrustStorePassword()trust store passwordjava.lang.StringtrustStoreType()trust store type (to replace default javax.net.ssl.keyStoreType system property)booleanuseAffectedRows()Use affected rowbooleanuseBulkStmts()Use server COM_STMT_BULK for batching.booleanuseBulkStmtsForInserts()Use server COM_STMT_BULK for batching inserts.CatalogTermuseCatalogTerm()Indicating using Catalog or SchemabooleanuseCompression()Enable compression if server has compression capabilitybooleanuseLocalSessionState()use local state to avoid unnecessary queries.booleanuseMysqlMetadata()Force returning MySQL metadata informationjava.lang.Stringuser()configuration userbooleanuseReadAheadInput()Read all data from socket in advancebooleanuseResetConnection()Must connection returned to pool be RESETbooleanuseServerPrepStmts()Use server prepared statement.booleanuuidAsString()must uuid fields return as String and not java.util.UUIDbooleanyearIsDateType()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.SQLExceptionPermit 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:
toStringin classjava.lang.Object- Returns:
- String value
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
loadCodecs
private void loadCodecs()
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-