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

  • Field Details

    • URL_PARAMETER

      private static final Pattern URL_PARAMETER
    • user

      private String user
    • password

      private String password
    • database

      private String database
    • addresses

      private List<HostAddress> addresses
    • haMode

      private HaMode haMode
    • initialUrl

      private String initialUrl
    • nonMappedOptions

      private Properties nonMappedOptions
    • timezone

      private String timezone
    • autocommit

      private boolean autocommit
    • useMysqlMetadata

      private boolean useMysqlMetadata
    • transactionIsolation

      private TransactionIsolation transactionIsolation
    • defaultFetchSize

      private int defaultFetchSize
    • maxQuerySizeToLog

      private int maxQuerySizeToLog
    • geometryDefaultType

      private String geometryDefaultType
    • restrictedAuth

      private String restrictedAuth
    • socketFactory

      private String socketFactory
    • connectTimeout

      private int connectTimeout
    • pipe

      private String pipe
    • localSocket

      private String localSocket
    • tcpKeepAlive

      private boolean tcpKeepAlive
    • tcpKeepIdle

      private int tcpKeepIdle
    • tcpKeepCount

      private int tcpKeepCount
    • tcpKeepInterval

      private int tcpKeepInterval
    • tcpAbortiveClose

      private boolean tcpAbortiveClose
    • localSocketAddress

      private String localSocketAddress
    • socketTimeout

      private int socketTimeout
    • useReadAheadInput

      private boolean useReadAheadInput
    • tlsSocketType

      private String tlsSocketType
    • sslMode

      private SslMode sslMode
    • serverSslCert

      private String serverSslCert
    • keyStore

      private String keyStore
    • keyStorePassword

      private String keyStorePassword
    • keyStoreType

      private String keyStoreType
    • enabledSslCipherSuites

      private String enabledSslCipherSuites
    • enabledSslProtocolSuites

      private String enabledSslProtocolSuites
    • allowMultiQueries

      private boolean allowMultiQueries
    • allowLocalInfile

      private boolean allowLocalInfile
    • useCompression

      private boolean useCompression
    • useAffectedRows

      private boolean useAffectedRows
    • useBulkStmts

      private boolean useBulkStmts
    • cachePrepStmts

      private boolean cachePrepStmts
    • prepStmtCacheSize

      private int prepStmtCacheSize
    • useServerPrepStmts

      private boolean useServerPrepStmts
    • credentialType

      private CredentialPlugin credentialType
    • sessionVariables

      private String sessionVariables
    • connectionAttributes

      private String connectionAttributes
    • servicePrincipalName

      private String servicePrincipalName
    • blankTableNameMeta

      private boolean blankTableNameMeta
    • tinyInt1isBit

      private boolean tinyInt1isBit
    • yearIsDateType

      private boolean yearIsDateType
    • dumpQueriesOnException

      private boolean dumpQueriesOnException
    • includeInnodbStatusInDeadlockExceptions

      private boolean includeInnodbStatusInDeadlockExceptions
    • includeThreadDumpInDeadlockExceptions

      private boolean includeThreadDumpInDeadlockExceptions
    • retriesAllDown

      private int retriesAllDown
    • galeraAllowedState

      private String galeraAllowedState
    • transactionReplay

      private boolean transactionReplay
    • pool

      private boolean pool
    • poolName

      private 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 String serverRsaPublicKeyFile
    • allowPublicKeyRetrieval

      private boolean allowPublicKeyRetrieval
    • codecs

      private Codec<?>[] codecs
  • Constructor Details

    • Configuration

      private Configuration()
    • Configuration

      private Configuration(String user, String password, String database, List<HostAddress> addresses, HaMode haMode, Properties nonMappedOptions, String timezone, boolean autocommit, boolean useMysqlMetadata, TransactionIsolation transactionIsolation, int defaultFetchSize, int maxQuerySizeToLog, String geometryDefaultType, String restrictedAuth, String socketFactory, int connectTimeout, String pipe, String localSocket, boolean tcpKeepAlive, int tcpKeepIdle, int tcpKeepCount, int tcpKeepInterval, boolean tcpAbortiveClose, String localSocketAddress, int socketTimeout, boolean useReadAheadInput, String tlsSocketType, SslMode sslMode, String serverSslCert, String keyStore, String keyStorePassword, String keyStoreType, String enabledSslCipherSuites, String enabledSslProtocolSuites, boolean allowMultiQueries, boolean allowLocalInfile, boolean useCompression, boolean useAffectedRows, boolean useBulkStmts, boolean cachePrepStmts, int prepStmtCacheSize, boolean useServerPrepStmts, CredentialPlugin credentialType, String sessionVariables, String connectionAttributes, String servicePrincipalName, boolean blankTableNameMeta, boolean tinyInt1isBit, boolean yearIsDateType, boolean dumpQueriesOnException, boolean includeInnodbStatusInDeadlockExceptions, boolean includeThreadDumpInDeadlockExceptions, int retriesAllDown, String galeraAllowedState, boolean transactionReplay, boolean pool, String poolName, int maxPoolSize, int minPoolSize, int maxIdleTime, boolean registerJmxPool, int poolValidMinDelay, boolean useResetConnection, String serverRsaPublicKeyFile, boolean allowPublicKeyRetrieval)
    • Configuration

      private Configuration(String database, List<HostAddress> addresses, HaMode haMode, String user, String password, String enabledSslProtocolSuites, String socketFactory, Integer connectTimeout, String pipe, String localSocket, Boolean tcpKeepAlive, Integer tcpKeepIdle, Integer tcpKeepCount, Integer tcpKeepInterval, Boolean tcpAbortiveClose, String localSocketAddress, Integer socketTimeout, Boolean allowMultiQueries, Boolean allowLocalInfile, Boolean useCompression, Boolean blankTableNameMeta, String credentialType, String sslMode, String transactionIsolation, String enabledSslCipherSuites, String sessionVariables, Boolean tinyInt1isBit, Boolean yearIsDateType, String timezone, Boolean dumpQueriesOnException, Integer prepStmtCacheSize, Boolean useAffectedRows, Boolean useServerPrepStmts, String connectionAttributes, Boolean useBulkStmts, Boolean autocommit, Boolean useMysqlMetadata, Boolean includeInnodbStatusInDeadlockExceptions, Boolean includeThreadDumpInDeadlockExceptions, String servicePrincipalName, Integer defaultFetchSize, String tlsSocketType, Integer maxQuerySizeToLog, Integer retriesAllDown, String galeraAllowedState, Boolean pool, String poolName, Integer maxPoolSize, Integer minPoolSize, Integer maxIdleTime, Boolean registerJmxPool, Integer poolValidMinDelay, Boolean useResetConnection, String serverRsaPublicKeyFile, Boolean allowPublicKeyRetrieval, String serverSslCert, String keyStore, String keyStorePassword, String keyStoreType, Boolean useReadAheadInput, Boolean cachePrepStmts, Boolean transactionReplay, String geometryDefaultType, String restrictedAuth, Properties nonMappedOptions) throws SQLException
      Throws:
      SQLException
  • Method Details

    • 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
      Throws:
      SQLException
    • parse

      public static Configuration parse(String url, Properties prop) throws SQLException
      Parse url connection string with additional properties.
      Parameters:
      url - connection string
      prop - properties
      Returns:
      UrlParser instance
      Throws:
      SQLException - if parsing exception occur
    • parseInternal

      private static Configuration parseInternal(String url, Properties properties) throws SQLException
      Parses the connection URL in order to set the UrlParser instance with all the information provided through the URL.
      Parameters:
      url - connection URL
      properties - properties
      Throws:
      SQLException - if format is incorrect
    • mapPropertiesToOption

      private static void mapPropertiesToOption(Configuration.Builder builder, Properties properties)
    • isSet

      private static boolean isSet(String key, Properties nonMappedOptions)
    • parseHaMode

      private static HaMode parseHaMode(String url, int separator)
    • clone

      public Configuration clone(String username, String password)
    • database

      public String database()
    • addresses

      public List<HostAddress> addresses()
    • haMode

      public HaMode haMode()
    • credentialPlugin

      public CredentialPlugin credentialPlugin()
    • user

      public String user()
    • password

      public String password()
    • initialUrl

      public String initialUrl()
    • serverSslCert

      public String serverSslCert()
    • keyStore

      public String keyStore()
    • keyStorePassword

      public String keyStorePassword()
    • keyStoreType

      public String keyStoreType()
    • enabledSslProtocolSuites

      public String enabledSslProtocolSuites()
    • socketFactory

      public String socketFactory()
    • connectTimeout

      public int connectTimeout()
    • connectTimeout

      public Configuration connectTimeout(int connectTimeout)
    • pipe

      public String pipe()
    • localSocket

      public String localSocket()
    • tcpKeepAlive

      public boolean tcpKeepAlive()
    • tcpKeepIdle

      public int tcpKeepIdle()
    • tcpKeepCount

      public int tcpKeepCount()
    • tcpKeepInterval

      public int tcpKeepInterval()
    • tcpAbortiveClose

      public boolean tcpAbortiveClose()
    • localSocketAddress

      public String localSocketAddress()
    • socketTimeout

      public int socketTimeout()
    • allowMultiQueries

      public boolean allowMultiQueries()
    • allowLocalInfile

      public boolean allowLocalInfile()
    • useCompression

      public boolean useCompression()
    • blankTableNameMeta

      public boolean blankTableNameMeta()
    • sslMode

      public SslMode sslMode()
    • transactionIsolation

      public TransactionIsolation transactionIsolation()
    • enabledSslCipherSuites

      public String enabledSslCipherSuites()
    • sessionVariables

      public String sessionVariables()
    • tinyInt1isBit

      public boolean tinyInt1isBit()
    • yearIsDateType

      public boolean yearIsDateType()
    • timezone

      public String timezone()
    • dumpQueriesOnException

      public boolean dumpQueriesOnException()
    • prepStmtCacheSize

      public int prepStmtCacheSize()
    • useAffectedRows

      public boolean useAffectedRows()
    • useServerPrepStmts

      public boolean useServerPrepStmts()
    • connectionAttributes

      public String connectionAttributes()
    • useBulkStmts

      public boolean useBulkStmts()
    • autocommit

      public boolean autocommit()
    • useMysqlMetadata

      public boolean useMysqlMetadata()
    • includeInnodbStatusInDeadlockExceptions

      public boolean includeInnodbStatusInDeadlockExceptions()
    • includeThreadDumpInDeadlockExceptions

      public boolean includeThreadDumpInDeadlockExceptions()
    • servicePrincipalName

      public String servicePrincipalName()
    • defaultFetchSize

      public int defaultFetchSize()
    • nonMappedOptions

      public Properties nonMappedOptions()
    • tlsSocketType

      public String tlsSocketType()
    • maxQuerySizeToLog

      public int maxQuerySizeToLog()
    • retriesAllDown

      public int retriesAllDown()
    • galeraAllowedState

      public String galeraAllowedState()
    • pool

      public boolean pool()
    • poolName

      public String poolName()
    • maxPoolSize

      public int maxPoolSize()
    • minPoolSize

      public int minPoolSize()
    • maxIdleTime

      public int maxIdleTime()
    • registerJmxPool

      public boolean registerJmxPool()
    • poolValidMinDelay

      public int poolValidMinDelay()
    • useResetConnection

      public boolean useResetConnection()
    • serverRsaPublicKeyFile

      public String serverRsaPublicKeyFile()
    • allowPublicKeyRetrieval

      public boolean allowPublicKeyRetrieval()
    • useReadAheadInput

      public boolean useReadAheadInput()
    • cachePrepStmts

      public boolean cachePrepStmts()
    • transactionReplay

      public boolean transactionReplay()
    • geometryDefaultType

      public String geometryDefaultType()
    • restrictedAuth

      public String restrictedAuth()
    • codecs

      public Codec<?>[] codecs()
    • toString

      public String toString()
      ToString implementation.
      Overrides:
      toString in class Object
      Returns:
      String value
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • buildUrl

      protected static String buildUrl(Configuration conf)
    • loadCodecs

      private void loadCodecs()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • nullOrEmpty

      private static String nullOrEmpty(String val)