Class Configuration.Builder

  • All Implemented Interfaces:
    java.lang.Cloneable
    Enclosing class:
    Configuration

    public static final class Configuration.Builder
    extends java.lang.Object
    implements java.lang.Cloneable
    A builder for Configuration instances.
    • Field Detail

      • _nonMappedOptions

        private java.util.Properties _nonMappedOptions
      • _haMode

        private HaMode _haMode
      • user

        java.lang.String user
      • password

        java.lang.String password
      • database

        private java.lang.String database
      • timezone

        private java.lang.String timezone
      • connectionTimeZone

        private java.lang.String connectionTimeZone
      • connectionCollation

        private java.lang.String connectionCollation
      • forceConnectionTimeZoneToSession

        private java.lang.Boolean forceConnectionTimeZoneToSession
      • preserveInstants

        private java.lang.Boolean preserveInstants
      • pureLocalDateTime

        private java.lang.Boolean pureLocalDateTime
      • autocommit

        private java.lang.Boolean autocommit
      • useMysqlMetadata

        private java.lang.Boolean useMysqlMetadata
      • nullDatabaseMeansCurrent

        private java.lang.Boolean nullDatabaseMeansCurrent
      • useCatalogTerm

        private java.lang.String useCatalogTerm
      • createDatabaseIfNotExist

        private java.lang.Boolean createDatabaseIfNotExist
      • useLocalSessionState

        private java.lang.Boolean useLocalSessionState
      • readOnlyPropagatesToServer

        private java.lang.Boolean readOnlyPropagatesToServer
      • returnMultiValuesGeneratedIds

        private java.lang.Boolean returnMultiValuesGeneratedIds
      • jdbcCompliantTruncation

        private java.lang.Boolean jdbcCompliantTruncation
      • oldModeNoPrecisionTimestamp

        private java.lang.Boolean oldModeNoPrecisionTimestamp
      • permitRedirect

        private java.lang.Boolean permitRedirect
      • pinGlobalTxToPhysicalConnection

        private java.lang.Boolean pinGlobalTxToPhysicalConnection
      • permitNoResults

        private java.lang.Boolean permitNoResults
      • cacheCodecs

        private java.lang.Boolean cacheCodecs
      • defaultFetchSize

        private java.lang.Integer defaultFetchSize
      • maxQuerySizeToLog

        private java.lang.Integer maxQuerySizeToLog
      • maxAllowedPacket

        private java.lang.Integer maxAllowedPacket
      • maxAllowedColumns

        private java.lang.Integer maxAllowedColumns
      • geometryDefaultType

        private java.lang.String geometryDefaultType
      • restrictedAuth

        private java.lang.String restrictedAuth
      • initSql

        private java.lang.String initSql
      • transactionIsolation

        private java.lang.String transactionIsolation
      • metaExportedKeys

        private java.lang.String metaExportedKeys
      • socketFactory

        private java.lang.String socketFactory
      • connectTimeout

        java.lang.Integer connectTimeout
      • pipe

        private java.lang.String pipe
      • localSocket

        private java.lang.String localSocket
      • tcpKeepAlive

        private java.lang.Boolean tcpKeepAlive
      • uuidAsString

        private java.lang.Boolean uuidAsString
      • tcpKeepIdle

        private java.lang.Integer tcpKeepIdle
      • tcpKeepCount

        private java.lang.Integer tcpKeepCount
      • tcpKeepInterval

        private java.lang.Integer tcpKeepInterval
      • tcpAbortiveClose

        private java.lang.Boolean tcpAbortiveClose
      • localSocketAddress

        private java.lang.String localSocketAddress
      • socketTimeout

        private java.lang.Integer socketTimeout
      • useReadAheadInput

        private java.lang.Boolean useReadAheadInput
      • tlsSocketType

        private java.lang.String tlsSocketType
      • sslMode

        private java.lang.String 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 java.lang.Boolean fallbackToSystemKeyStore
      • fallbackToSystemTrustStore

        private java.lang.Boolean fallbackToSystemTrustStore
      • allowMultiQueries

        private java.lang.Boolean allowMultiQueries
      • allowLocalInfile

        private java.lang.Boolean allowLocalInfile
      • rewriteBatchedStatements

        private java.lang.Boolean rewriteBatchedStatements
      • useCompression

        private java.lang.Boolean useCompression
      • useAffectedRows

        private java.lang.Boolean useAffectedRows
      • useBulkStmts

        private java.lang.Boolean useBulkStmts
      • useBulkStmtsForInserts

        private java.lang.Boolean useBulkStmtsForInserts
      • disablePipeline

        private java.lang.Boolean disablePipeline
      • cachePrepStmts

        private java.lang.Boolean cachePrepStmts
      • prepStmtCacheSize

        private java.lang.Integer prepStmtCacheSize
      • useServerPrepStmts

        private java.lang.Boolean useServerPrepStmts
      • credentialType

        private java.lang.String credentialType
      • sessionVariables

        private java.lang.String sessionVariables
      • connectionAttributes

        private java.lang.String connectionAttributes
      • servicePrincipalName

        private java.lang.String servicePrincipalName
      • disconnectOnExpiredPasswords

        private java.lang.Boolean disconnectOnExpiredPasswords
      • blankTableNameMeta

        private java.lang.Boolean blankTableNameMeta
      • tinyInt1isBit

        private java.lang.Boolean tinyInt1isBit
      • transformedBitIsBoolean

        private java.lang.Boolean transformedBitIsBoolean
      • yearIsDateType

        private java.lang.Boolean yearIsDateType
      • dumpQueriesOnException

        private java.lang.Boolean dumpQueriesOnException
      • includeInnodbStatusInDeadlockExceptions

        private java.lang.Boolean includeInnodbStatusInDeadlockExceptions
      • includeThreadDumpInDeadlockExceptions

        private java.lang.Boolean includeThreadDumpInDeadlockExceptions
      • retriesAllDown

        private java.lang.Integer retriesAllDown
      • galeraAllowedState

        private java.lang.String galeraAllowedState
      • transactionReplay

        private java.lang.Boolean transactionReplay
      • transactionReplaySize

        private java.lang.Integer transactionReplaySize
      • useIpForKillQuery

        private java.lang.Boolean useIpForKillQuery
      • pool

        private java.lang.Boolean pool
      • poolName

        private java.lang.String poolName
      • maxPoolSize

        private java.lang.Integer maxPoolSize
      • minPoolSize

        private java.lang.Integer minPoolSize
      • maxIdleTime

        private java.lang.Integer maxIdleTime
      • registerJmxPool

        private java.lang.Boolean registerJmxPool
      • poolValidMinDelay

        private java.lang.Integer poolValidMinDelay
      • useResetConnection

        private java.lang.Boolean useResetConnection
      • serverRsaPublicKeyFile

        private java.lang.String serverRsaPublicKeyFile
      • allowPublicKeyRetrieval

        private java.lang.Boolean allowPublicKeyRetrieval
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • serverSslCert

        public Configuration.Builder serverSslCert​(java.lang.String serverSslCert)
        Server SSL certificate (path or file content)
        Parameters:
        serverSslCert - set Server SSL certificate (path or file content)
        Returns:
        this Configuration.Builder
      • keyStore

        public Configuration.Builder keyStore​(java.lang.String keyStore)
        File path of the keyStore file that contain client private key store and associate certificates (similar to java System property \"javax.net.ssl.keyStore\", but ensure that only the private key's entries are used)
        Parameters:
        keyStore - client store certificates
        Returns:
        this Configuration.Builder
      • trustStore

        public Configuration.Builder trustStore​(java.lang.String trustStore)
        File path of the trustStore file that contain trusted certificates (similar to java System property \"javax.net.ssl.trustStore\")
        Parameters:
        trustStore - client trust store certificates
        Returns:
        this Configuration.Builder
      • keyStorePassword

        public Configuration.Builder keyStorePassword​(java.lang.String keyStorePassword)
        Client keystore password
        Parameters:
        keyStorePassword - client store password
        Returns:
        this Configuration.Builder
      • trustStorePassword

        public Configuration.Builder trustStorePassword​(java.lang.String trustStorePassword)
        Client truststore password
        Parameters:
        trustStorePassword - client truststore password
        Returns:
        this Configuration.Builder
      • keyPassword

        public Configuration.Builder keyPassword​(java.lang.String keyPassword)
        Client keystore alias password
        Parameters:
        keyPassword - client store alias password
        Returns:
        this Configuration.Builder
      • enabledSslProtocolSuites

        public Configuration.Builder enabledSslProtocolSuites​(java.lang.String enabledSslProtocolSuites)
        Set ssl protocol list to user (comma separated)
        Parameters:
        enabledSslProtocolSuites - set possible SSL(TLS) protocol to use
        Returns:
        this Configuration.Builder
      • fallbackToSystemKeyStore

        public Configuration.Builder fallbackToSystemKeyStore​(java.lang.Boolean fallbackToSystemKeyStore)
        Indicate if keystore system properties can be used.
        Parameters:
        fallbackToSystemKeyStore - set if keystore system properties can be used.
        Returns:
        this Configuration.Builder
      • fallbackToSystemTrustStore

        public Configuration.Builder fallbackToSystemTrustStore​(java.lang.Boolean fallbackToSystemTrustStore)
        Indicate if system default truststore can be used.
        Parameters:
        fallbackToSystemTrustStore - indicate if system default truststore can be used..
        Returns:
        this Configuration.Builder
      • addHost

        public Configuration.Builder addHost​(java.lang.String host,
                                             int port)
        Add Host to possible addresses to connect
        Parameters:
        host - hostname or IP
        port - port
        Returns:
        this Configuration.Builder
      • addHost

        public Configuration.Builder addHost​(java.lang.String host,
                                             int port,
                                             java.lang.String sslMode)
        Add Host to possible addresses to connect
        Parameters:
        host - hostname or IP
        port - port
        sslMode - ssl mode. possible values disable/trust/verify-ca/verify-full
        Returns:
        this Configuration.Builder
      • addHost

        public Configuration.Builder addHost​(java.lang.String host,
                                             int port,
                                             boolean master)
        Add Host to possible addresses to connect
        Parameters:
        host - hostname or IP
        port - port
        master - is master or replica
        Returns:
        this Configuration.Builder
      • addHost

        public Configuration.Builder addHost​(java.lang.String host,
                                             int port,
                                             boolean master,
                                             java.lang.String sslMode)
        Add Host to possible addresses to connect
        Parameters:
        host - hostname or IP
        port - port
        master - is master or replica
        sslMode - ssl mode. possible values disable/trust/verify-ca/verify-full
        Returns:
        this Configuration.Builder
      • connectTimeout

        public Configuration.Builder connectTimeout​(java.lang.Integer connectTimeout)
        Indicate connect timeout value, in milliseconds, or zero for no timeout. Default: 30000
        Parameters:
        connectTimeout - connect Timeout
        Returns:
        this Configuration.Builder
      • pipe

        public Configuration.Builder pipe​(java.lang.String pipe)
        Indicate to use windows named pipe, specify named pipe name to connect
        Parameters:
        pipe - windows named pipe
        Returns:
        this Configuration.Builder
      • localSocket

        public Configuration.Builder localSocket​(java.lang.String localSocket)
        Indicate to use Unix domain socket, if the server allows it, specifying named pipe name to connect The value is the path of Unix domain socket (available with "select @@socket" command).
        Parameters:
        localSocket - local socket path
        Returns:
        this Configuration.Builder
      • uuidAsString

        public Configuration.Builder uuidAsString​(java.lang.Boolean uuidAsString)
        Indicate if UUID fields must returns as String
        Parameters:
        uuidAsString - value
        Returns:
        this Configuration.Builder
      • tcpKeepCount

        public Configuration.Builder tcpKeepCount​(java.lang.Integer tcpKeepCount)
        Indicate TCP keep-count value (for java 11+ only).
        Parameters:
        tcpKeepCount - value
        Returns:
        this Configuration.Builder
      • tcpKeepInterval

        public Configuration.Builder tcpKeepInterval​(java.lang.Integer tcpKeepInterval)
        Indicate TCP keep-interval value (for java 11+ only).
        Parameters:
        tcpKeepInterval - value
        Returns:
        this Configuration.Builder
      • tcpAbortiveClose

        public Configuration.Builder tcpAbortiveClose​(java.lang.Boolean tcpAbortiveClose)
        Indicate that when connection fails, to send an RST TCP packet.
        Parameters:
        tcpAbortiveClose - value
        Returns:
        this Configuration.Builder
      • geometryDefaultType

        public Configuration.Builder geometryDefaultType​(java.lang.String geometryDefault)
        Indicate what default Object type Geometry a resultset.getObject must return. possibility :
        • null or empty is WKB byte array
        • 'default' will return org.mariadb.mariadb.jdbc.type Object
        In the future JTS might be implemented
        Parameters:
        geometryDefault - value
        Returns:
        this Configuration.Builder
      • restrictedAuth

        public Configuration.Builder restrictedAuth​(java.lang.String restrictedAuth)
        restrict authentication method to secure list. Default "default".
        Parameters:
        restrictedAuth - use authentication plugin list
        Returns:
        this Configuration.Builder
      • initSql

        public Configuration.Builder initSql​(java.lang.String initSql)
        permit to execute an SQL command on connection creation
        Parameters:
        initSql - initial SQL command
        Returns:
        this Configuration.Builder
      • localSocketAddress

        public Configuration.Builder localSocketAddress​(java.lang.String localSocketAddress)
        Indicate Hostname or IP address to bind the connection socket to a local (UNIX domain) socket.
        Parameters:
        localSocketAddress - Hostname or IP address
        Returns:
        this Configuration.Builder
      • socketTimeout

        public Configuration.Builder socketTimeout​(java.lang.Integer socketTimeout)
        Indicate the network socket timeout (SO_TIMEOUT) in milliseconds. Value of 0 disables this timeout.

        If the goal is to set a timeout for all queries, the server has permitted a solution to limit the query time by setting a system variable, max_statement_time. Default: 0

        Parameters:
        socketTimeout - socket timeout value
        Returns:
        this Configuration.Builder
      • allowMultiQueries

        public Configuration.Builder allowMultiQueries​(java.lang.Boolean allowMultiQueries)
        Indicate that multi-queries are allowed. example: "insert into ab (i) values (1); insert into ab (i) values (2)".

        If application build sql command string, this is probably a bad idea to enable this option, opening the door to sql injection. default: false.

        Parameters:
        allowMultiQueries - indicate if active
        Returns:
        this Configuration.Builder
      • allowLocalInfile

        public Configuration.Builder allowLocalInfile​(java.lang.Boolean allowLocalInfile)
        Indicate if LOAD DATA LOCAL INFILE are permitted. This will disable all pipelining implementation.
        Parameters:
        allowLocalInfile - indicate if permit LOAD DATA LOCAL INFILE commands
        Returns:
        this Configuration.Builder
      • rewriteBatchedStatements

        public Configuration.Builder rewriteBatchedStatements​(java.lang.Boolean rewriteBatchedStatements)
        For insert queries, rewrite batchedStatement to execute in a single executeQuery.

        example: "insert into ab (i) values (?)" with first batch values = 1, second = 2 will be rewritten "insert into ab (i) values (1), (2)".

        If query cannot be rewriten in "multi-values", rewrite will use multi-queries : "INSERT INTO TABLE(col1) VALUES (?) ON DUPLICATE KEY UPDATE col2=?" with values [1,2] and [3,4] will be rewritten "INSERT INTO TABLE(col1) VALUES (1) ON DUPLICATE KEY UPDATE col2=2;INSERT INTO TABLE(col1) VALUES (3) ON DUPLICATE KEY UPDATE col2=4"

        when active, the useServerPrepStmts option is set to false

        Parameters:
        rewriteBatchedStatements - to enable/disable rewrite
        Returns:
        this Configuration.Builder
      • useCompression

        public Configuration.Builder useCompression​(java.lang.Boolean useCompression)
        Indicate to compress exchanges with the database through gzip. This permits better performance when the database is not in the same location.
        Parameters:
        useCompression - to enable/disable compression
        Returns:
        this Configuration.Builder
      • blankTableNameMeta

        public Configuration.Builder blankTableNameMeta​(java.lang.Boolean blankTableNameMeta)
        Set blank table name for metadata (old oracle compatibility)
        Parameters:
        blankTableNameMeta - use blank table name
        Returns:
        this Configuration.Builder
      • disconnectOnExpiredPasswords

        public Configuration.Builder disconnectOnExpiredPasswords​(java.lang.Boolean disconnectOnExpiredPasswords)
        On connection creation, indicate behavior when password is expired. When true (default) throw an expired password error When false, connection succeed in "sandbox" mode, only queries related to password change are allowed
        Returns:
        this Configuration.Builder
      • credentialType

        public Configuration.Builder credentialType​(java.lang.String credentialType)
        set credential plugin type
        Parameters:
        credentialType - credential plugin type
        Returns:
        this Configuration.Builder
      • transactionIsolation

        public Configuration.Builder transactionIsolation​(java.lang.String transactionIsolation)
        force default transaction isolation, not using server default
        Parameters:
        transactionIsolation - indicate default transaction isolation
        Returns:
        this Configuration.Builder
      • metaExportedKeys

        public Configuration.Builder metaExportedKeys​(java.lang.String metaExportedKeys)
        Indicate what implementation to use for metadata getExportedKeys. choice are "UseInformationSchema", "UseShowCreate" or "Auto"
        Parameters:
        metaExportedKeys - indicate implementation to use for metadata getExportedKeys
        Returns:
        this Configuration.Builder
      • enabledSslCipherSuites

        public Configuration.Builder enabledSslCipherSuites​(java.lang.String enabledSslCipherSuites)
        set possible cipher list (comma separated), not using default java cipher list
        Parameters:
        enabledSslCipherSuites - ssl cipher list
        Returns:
        this Configuration.Builder
      • sessionVariables

        public Configuration.Builder sessionVariables​(java.lang.String sessionVariables)
        set connection session variables (comma separated)
        Parameters:
        sessionVariables - session variable list
        Returns:
        this Configuration.Builder
      • tinyInt1isBit

        public Configuration.Builder tinyInt1isBit​(java.lang.Boolean tinyInt1isBit)
        TinyInt(1) to be considered as bit
        Parameters:
        tinyInt1isBit - Indicate if Tinyint(1) to be considered as bit
        Returns:
        this Configuration.Builder
      • transformedBitIsBoolean

        public Configuration.Builder transformedBitIsBoolean​(java.lang.Boolean transformedBitIsBoolean)
        TinyInt(1) to be considered as boolean
        Parameters:
        transformedBitIsBoolean - Indicate if Tinyint(1) to be considered as boolean
        Returns:
        this Configuration.Builder
      • yearIsDateType

        public Configuration.Builder yearIsDateType​(java.lang.Boolean yearIsDateType)
        Year datatype to be considered as date
        Parameters:
        yearIsDateType - indicate if Year must be considered as Date
        Returns:
        this Configuration.Builder
      • timezone

        public Configuration.Builder timezone​(java.lang.String timezone)
        Force timezone to use this timezone, not default java one
        Parameters:
        timezone - default timezone
        Returns:
        this Configuration.Builder
      • connectionTimeZone

        public Configuration.Builder connectionTimeZone​(java.lang.String connectionTimeZone)
        indicate what timestamp timezone to use in exchanges with server possible value are LOCAL|SERVER|user-defined time zone
        Parameters:
        connectionTimeZone - default timezone
        Returns:
        this Configuration.Builder
      • connectionCollation

        public Configuration.Builder connectionCollation​(java.lang.String connectionCollation)
        indicate what utf8mb4 collation to use. if not set, server default collation for utf8mb4 will be used
        Parameters:
        connectionCollation - utf8mb4 collation to use
        Returns:
        this Configuration.Builder
      • forceConnectionTimeZoneToSession

        public Configuration.Builder forceConnectionTimeZoneToSession​(java.lang.Boolean forceConnectionTimeZoneToSession)
        Indicate if connectionTimeZone must be forced to session
        Parameters:
        forceConnectionTimeZoneToSession - must connector force connection timezone
        Returns:
        this Configuration.Builder
      • preserveInstants

        public Configuration.Builder preserveInstants​(java.lang.Boolean preserveInstants)
        Indicate if connection must preserve instants
        Parameters:
        preserveInstants - must connector preserve instants
        Returns:
        this Configuration.Builder
      • pureLocalDateTime

        public Configuration.Builder pureLocalDateTime​(java.lang.Boolean pureLocalDateTime)
        Indicate if LocalDateTime is treated as a pure zoneless wall-clock value (default true). When false, preserveInstants also converts LocalDateTime between the connection time zone and the JVM default.
        Parameters:
        pureLocalDateTime - treat LocalDateTime as a pure zoneless value
        Returns:
        this Configuration.Builder
      • dumpQueriesOnException

        public Configuration.Builder dumpQueriesOnException​(java.lang.Boolean dumpQueriesOnException)
        Must queries be dump on exception stracktrace.
        Parameters:
        dumpQueriesOnException - must queries be dump on exception
        Returns:
        this Configuration.Builder
      • prepStmtCacheSize

        public Configuration.Builder prepStmtCacheSize​(java.lang.Integer prepStmtCacheSize)
        If using server prepared statement, set LRU prepare cache size
        Parameters:
        prepStmtCacheSize - prepare cache size
        Returns:
        this Configuration.Builder
      • useAffectedRows

        public Configuration.Builder useAffectedRows​(java.lang.Boolean useAffectedRows)
        Indicate server to return affected rows in place of found rows. This impact the return number of rows affected by update
        Parameters:
        useAffectedRows - Indicate to user affected rows in place of found rows
        Returns:
        this Configuration.Builder
      • useServerPrepStmts

        public Configuration.Builder useServerPrepStmts​(java.lang.Boolean useServerPrepStmts)
        Indicate to use Client or Server prepared statement
        Parameters:
        useServerPrepStmts - use Server prepared statement
        Returns:
        this Configuration.Builder
      • connectionAttributes

        public Configuration.Builder connectionAttributes​(java.lang.String connectionAttributes)
        Additional connection attributes to identify connection
        Parameters:
        connectionAttributes - additional connection attributes
        Returns:
        this Configuration.Builder
      • useBulkStmts

        public Configuration.Builder useBulkStmts​(java.lang.Boolean useBulkStmts)
        Use server dedicated bulk batch command
        Parameters:
        useBulkStmts - use server bulk batch command.
        Returns:
        this Configuration.Builder
      • useBulkStmtsForInserts

        public Configuration.Builder useBulkStmtsForInserts​(java.lang.Boolean useBulkStmtsForInserts)
        Use server dedicated bulk batch command for insert (if useBulkStmts is enabled, useBulkStmtsForInserts will be enabled as well)
        Parameters:
        useBulkStmtsForInserts - use server bulk batch command.
        Returns:
        this Configuration.Builder
      • autocommit

        public Configuration.Builder autocommit​(java.lang.Boolean autocommit)
        Permit to force autocommit connection value
        Parameters:
        autocommit - autocommit value
        Returns:
        this Configuration.Builder
      • useMysqlMetadata

        public Configuration.Builder useMysqlMetadata​(java.lang.Boolean useMysqlMetadata)
        Permit indicating to force DatabaseMetadata.getDatabaseProductName() to return `MySQL` as database type, not real database type
        Parameters:
        useMysqlMetadata - force DatabaseMetadata.getDatabaseProductName() to return `MySQL`
        Returns:
        this Configuration.Builder
      • nullDatabaseMeansCurrent

        public Configuration.Builder nullDatabaseMeansCurrent​(java.lang.Boolean nullDatabaseMeansCurrent)
        Permit indicating in DatabaseMetadata if null value must be considered current schema/catalog
        Parameters:
        nullDatabaseMeansCurrent - indicating in DatabaseMetadata if null value must be considered current schema/catalog
        Returns:
        this Configuration.Builder
      • useCatalogTerm

        public Configuration.Builder useCatalogTerm​(java.lang.String useCatalogTerm)
        "schema" and "database" are server synonymous. Connector historically get/set database using Connection.setCatalog()/getCatalog(), setSchema()/getSchema() being no-op This parameter indicate to change that behavior to use Schema in place of Catalog. Behavior will change
        • database change will be done with either Connection.setCatalog()/getCatalog() or Connection.setSchema()/getSchema()
        • DatabaseMetadata methods that use catalog or schema filtering
        • ResultsetMetadata database will be retrieved
        Parameters:
        useCatalogTerm - use CATALOG/SCHEMA
        Returns:
        this Configuration.Builder
      • createDatabaseIfNotExist

        public Configuration.Builder createDatabaseIfNotExist​(java.lang.Boolean createDatabaseIfNotExist)
        Create database if not exist. This is mainly for test, since does require an additional query after connection
        Parameters:
        createDatabaseIfNotExist - must driver create database if doesn't exist
        Returns:
        this Configuration.Builder
      • useLocalSessionState

        public Configuration.Builder useLocalSessionState​(java.lang.Boolean useLocalSessionState)
        indicate if connector can 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
        Parameters:
        useLocalSessionState - can driver rely on local state
        Returns:
        this Configuration.Builder
      • readOnlyPropagatesToServer

        public Configuration.Builder readOnlyPropagatesToServer​(java.lang.Boolean readOnlyPropagatesToServer)
        When enabled (the default), Connection.setReadOnly(boolean) on a single-host connection propagates the read-only state to the server by issuing SET SESSION TRANSACTION READ ONLY / READ WRITE, for servers >= 5.6.5, so the server rejects DML on a read-only connection. Multi-host replica connections are already read-only at connection time. When disabled, setReadOnly() sends no statement on a single-host connection.
        Parameters:
        readOnlyPropagatesToServer - propagate read-only state to the server on setReadOnly()
        Returns:
        this Configuration.Builder
      • returnMultiValuesGeneratedIds

        public Configuration.Builder returnMultiValuesGeneratedIds​(java.lang.Boolean returnMultiValuesGeneratedIds)
        indicate if connector must return multi-generated ids. (For connector 2.x compatibility)
        Parameters:
        returnMultiValuesGeneratedIds - must return multi-values generated ids
        Returns:
        this Configuration.Builder
      • jdbcCompliantTruncation

        public Configuration.Builder jdbcCompliantTruncation​(java.lang.Boolean jdbcCompliantTruncation)
        indicate if connector must force sql_mode strict mode for jdbc compliance
        Parameters:
        jdbcCompliantTruncation - must force sql_mode strict mode for jdbc compliance
        Returns:
        this Configuration.Builder
      • oldModeNoPrecisionTimestamp

        public Configuration.Builder oldModeNoPrecisionTimestamp​(java.lang.Boolean oldModeNoPrecisionTimestamp)
        Force Timestamp string representation compatible 2.7 version Timestamp string representation will then correspond to Timestamp.toString() in place of taking field precision
        Parameters:
        oldModeNoPrecisionTimestamp - force 2.7 timestamp to string behavior
        Returns:
        this Configuration.Builder
      • permitRedirect

        public Configuration.Builder permitRedirect​(java.lang.Boolean permitRedirect)
        indicate if connector must redirect connection when receiving server redirect information
        Parameters:
        permitRedirect - must redirect when required
        Returns:
        this Configuration.Builder
      • pinGlobalTxToPhysicalConnection

        public Configuration.Builder pinGlobalTxToPhysicalConnection​(java.lang.Boolean pinGlobalTxToPhysicalConnection)
        Indicate if for XA transaction, connector must reuse same connection.
        Parameters:
        pinGlobalTxToPhysicalConnection - force reuse of same connection
        Returns:
        this Configuration.Builder
      • permitNoResults

        public Configuration.Builder permitNoResults​(java.lang.Boolean permitNoResults)
        Indicate if Statement/PreparedStatement.executeQuery for command that produce no result will return an exception or just an empty result-set When enabled, command not returning no data will end returning an empty result-set When disabled, command not returning no data will end throwing an exception
        Parameters:
        permitNoResults - force reuse of same connection
        Returns:
        this Configuration.Builder
      • includeInnodbStatusInDeadlockExceptions

        public Configuration.Builder includeInnodbStatusInDeadlockExceptions​(java.lang.Boolean includeInnodbStatusInDeadlockExceptions)
        On dead-lock exception must add innodb status in exception error message. If enabled, an additional command will be done to retrieve innodb status when dead-lock occurs.
        Parameters:
        includeInnodbStatusInDeadlockExceptions - Must dead-lock exception must add innodb status in exception error message
        Returns:
        this Configuration.Builder
      • includeThreadDumpInDeadlockExceptions

        public Configuration.Builder includeThreadDumpInDeadlockExceptions​(java.lang.Boolean includeThreadDumpInDeadlockExceptions)
        Dead-lock error will contain threads information
        Parameters:
        includeThreadDumpInDeadlockExceptions - must dead-lock error contain treads informations
        Returns:
        this Configuration.Builder
      • servicePrincipalName

        public Configuration.Builder servicePrincipalName​(java.lang.String servicePrincipalName)
        set service principal name (GSSAPI)
        Parameters:
        servicePrincipalName - service principal name (GSSAPI)
        Returns:
        this Configuration.Builder
      • defaultFetchSize

        public Configuration.Builder defaultFetchSize​(java.lang.Integer defaultFetchSize)
        Set default fetch size
        Parameters:
        defaultFetchSize - default fetch size
        Returns:
        this Configuration.Builder
      • tlsSocketType

        public Configuration.Builder tlsSocketType​(java.lang.String tlsSocketType)
        Permit to defined default tls plugin type
        Parameters:
        tlsSocketType - default tls socket plugin to use
        Returns:
        this Configuration.Builder
      • maxQuerySizeToLog

        public Configuration.Builder maxQuerySizeToLog​(java.lang.Integer maxQuerySizeToLog)
        Set the log size limit for query
        Parameters:
        maxQuerySizeToLog - set query size limit
        Returns:
        this Configuration.Builder
      • maxAllowedPacket

        public Configuration.Builder maxAllowedPacket​(java.lang.Integer maxAllowedPacket)
        Maximum size (in bytes) of a packet the driver will send or receive. This is advertised to the server during the handshake (capped to 16Mb for the connection phase), lets the driver reject a command too big to send (which would make the server drop the connection), and rejects an oversized packet received from the server. Leave unset to enforce no send-side limit; the receive side then falls back to a server-independent heap-relative ceiling (a quarter of the JVM max heap, clamped between 16Mb and 1Gb).
        Parameters:
        maxAllowedPacket - maximum packet size the driver will send or receive
        Returns:
        this Configuration.Builder
      • maxAllowedColumns

        public Configuration.Builder maxAllowedColumns​(java.lang.Integer maxAllowedColumns)
        Maximum number of columns the driver will accept in result-set or prepare metadata received from the server. Reading column metadata allocates memory proportional to the announced column count, so a malicious proxy announcing a huge count could exhaust client memory. When the server announces more columns than this limit, the command is interrupted with an error. Defaults to 65535.
        Parameters:
        maxAllowedColumns - maximum allowed number of columns
        Returns:
        this Configuration.Builder
      • retriesAllDown

        public Configuration.Builder retriesAllDown​(java.lang.Integer retriesAllDown)
        When failover occurs, how many connection attempt before throwing error when reconnecting
        Parameters:
        retriesAllDown - number of attemps to reconnect
        Returns:
        this Configuration.Builder
      • galeraAllowedState

        public Configuration.Builder galeraAllowedState​(java.lang.String galeraAllowedState)
        Indicate galera allowed state (comma separated), permitting to validate if galera node is synchronized
        Parameters:
        galeraAllowedState - galera allowed state
        Returns:
        this Configuration.Builder
      • pool

        public Configuration.Builder pool​(java.lang.Boolean pool)
        Create pool if not existing, or get a connection for the pool associate with this connection string if existing.
        Parameters:
        pool - use pool
        Returns:
        this Configuration.Builder
      • maxPoolSize

        public Configuration.Builder maxPoolSize​(java.lang.Integer maxPoolSize)
        Set the limit number of connection in pool.
        Parameters:
        maxPoolSize - maximum connection size in pool.
        Returns:
        this Configuration.Builder
      • maxIdleTime

        public Configuration.Builder maxIdleTime​(java.lang.Integer maxIdleTime)
        Set the maximum idle time of a connection indicating that connection must be released
        Parameters:
        maxIdleTime - maximum idle time of a connection in pool
        Returns:
        this Configuration.Builder
      • registerJmxPool

        public Configuration.Builder registerJmxPool​(java.lang.Boolean registerJmxPool)
        Must pool register JMX information
        Parameters:
        registerJmxPool - register pool to JMX
        Returns:
        this Configuration.Builder
      • poolValidMinDelay

        public Configuration.Builder poolValidMinDelay​(java.lang.Integer poolValidMinDelay)
        Pool will validate connection before giving it. This amount of time indicate that recently use connection can skip validation 0 means connection will be validated each time (even is just used)
        Parameters:
        poolValidMinDelay - time limit indicating that connection in pool must be validated
        Returns:
        this Configuration.Builder
      • useResetConnection

        public Configuration.Builder useResetConnection​(java.lang.Boolean useResetConnection)
        Indicate that connection returned to pool must be RESETed like having proper connection state.
        Parameters:
        useResetConnection - use reset connection when returning connection to pool.
        Returns:
        this Configuration.Builder
      • serverRsaPublicKeyFile

        public Configuration.Builder serverRsaPublicKeyFile​(java.lang.String serverRsaPublicKeyFile)
        MySQL Authentication RSA server file, for mysql authentication
        Parameters:
        serverRsaPublicKeyFile - server RSA public key file
        Returns:
        this Configuration.Builder
      • allowPublicKeyRetrieval

        public Configuration.Builder allowPublicKeyRetrieval​(java.lang.Boolean allowPublicKeyRetrieval)
        Allow RSA server file retrieval from MySQL server
        Parameters:
        allowPublicKeyRetrieval - Allow RSA server file retrieval from MySQL server
        Returns:
        this Configuration.Builder
      • useReadAheadInput

        public Configuration.Builder useReadAheadInput​(java.lang.Boolean useReadAheadInput)
        Cache all socket available information.
        Parameters:
        useReadAheadInput - cache available socket data when reading socket.
        Returns:
        this Configuration.Builder
      • cachePrepStmts

        public Configuration.Builder cachePrepStmts​(java.lang.Boolean cachePrepStmts)
        Cache server prepare result
        Parameters:
        cachePrepStmts - cache server prepared result
        Returns:
        this Configuration.Builder
      • transactionReplay

        public Configuration.Builder transactionReplay​(java.lang.Boolean transactionReplay)
        Must cache commands in transaction and replay transaction on failover.
        Parameters:
        transactionReplay - cache transaction and replay on failover
        Returns:
        this Configuration.Builder
      • transactionReplaySize

        public Configuration.Builder transactionReplaySize​(java.lang.Integer transactionReplaySize)
        Transaction replay cache size
        Parameters:
        transactionReplaySize - transaction replay cache size
        Returns:
        this Configuration.Builder
      • useIpForKillQuery

        public Configuration.Builder useIpForKillQuery​(java.lang.Boolean useIpForKillQuery)
        When cancelling a query, reuse the current socket IP instead of the original hostname. By default (false) the kill connection uses the original hostname, which is required for SSL hostname verification (sslMode=verify-full). Set to true when DNS may resolve to multiple back-ends so the kill connection still targets the same host.
        Parameters:
        useIpForKillQuery - use socket IP for the kill connection
        Returns:
        this Configuration.Builder
      • build

        public Configuration build()
        Build a configuration
        Returns:
        a Configuration object