Class Configuration.Builder

    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • serverSslCert

        public Configuration.Builder serverSslCert​(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​(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
      • enabledSslProtocolSuites

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

        public Configuration.Builder addHost​(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
      • connectTimeout

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

        public Configuration.Builder localSocket​(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
      • geometryDefaultType

        public Configuration.Builder geometryDefaultType​(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​(String restrictedAuth)
        restrict authentication method to secure list. Default "default".
        Parameters:
        restrictedAuth - use authentication plugin list
        Returns:
        this Configuration.Builder
      • localSocketAddress

        public Configuration.Builder localSocketAddress​(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​(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​(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​(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
      • useCompression

        public Configuration.Builder useCompression​(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​(Boolean blankTableNameMeta)
        Set blank table name for metadata (old oracle compatibility)
        Parameters:
        blankTableNameMeta - use blank table name
        Returns:
        this Configuration.Builder
      • transactionIsolation

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

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

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

        public Configuration.Builder dumpQueriesOnException​(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​(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​(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​(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​(String connectionAttributes)
        Additional connection attributes to identify connection
        Parameters:
        connectionAttributes - additional connection attributes
        Returns:
        this Configuration.Builder
      • useBulkStmtsForInserts

        public Configuration.Builder useBulkStmtsForInserts​(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
      • useMysqlMetadata

        public Configuration.Builder useMysqlMetadata​(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
      • useCatalogTerm

        public Configuration.Builder useCatalogTerm​(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​(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​(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
      • includeInnodbStatusInDeadlockExceptions

        public Configuration.Builder includeInnodbStatusInDeadlockExceptions​(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​(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​(String servicePrincipalName)
        set service principal name (GSSAPI)
        Parameters:
        servicePrincipalName - service principal name (GSSAPI)
        Returns:
        this Configuration.Builder
      • maxAllowedPacket

        public Configuration.Builder maxAllowedPacket​(Integer maxAllowedPacket)
        Indicate to driver server max_allowed_packet. This permit to driver to avoid sending commands too big, that would have make server to drop connection
        Parameters:
        maxAllowedPacket - indicate server max_allowed_packet value
        Returns:
        this Configuration.Builder
      • retriesAllDown

        public Configuration.Builder retriesAllDown​(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​(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
      • maxIdleTime

        public Configuration.Builder maxIdleTime​(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
      • poolValidMinDelay

        public Configuration.Builder poolValidMinDelay​(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​(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​(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​(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​(Boolean useReadAheadInput)
        Cache all socket available information.
        Parameters:
        useReadAheadInput - cache available socket data when reading socket.
        Returns:
        this Configuration.Builder
      • transactionReplay

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