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
      • _addresses

        private java.util.List<HostAddress> _addresses
      • user

        private java.lang.String user
      • password

        private java.lang.String password
      • database

        private java.lang.String database
      • timezone

        private java.lang.String timezone
      • autocommit

        private java.lang.Boolean autocommit
      • useMysqlMetadata

        private java.lang.Boolean useMysqlMetadata
      • defaultFetchSize

        private java.lang.Integer defaultFetchSize
      • maxQuerySizeToLog

        private java.lang.Integer maxQuerySizeToLog
      • geometryDefaultType

        private java.lang.String geometryDefaultType
      • restrictedAuth

        private java.lang.String restrictedAuth
      • transactionIsolation

        private java.lang.String transactionIsolation
      • socketFactory

        private java.lang.String socketFactory
      • connectTimeout

        private java.lang.Integer connectTimeout
      • pipe

        private java.lang.String pipe
      • localSocket

        private java.lang.String localSocket
      • tcpKeepAlive

        private java.lang.Boolean tcpKeepAlive
      • 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
      • keyStorePassword

        private java.lang.String keyStorePassword
      • keyStoreType

        private java.lang.String keyStoreType
      • enabledSslCipherSuites

        private java.lang.String enabledSslCipherSuites
      • enabledSslProtocolSuites

        private java.lang.String enabledSslProtocolSuites
      • allowMultiQueries

        private java.lang.Boolean allowMultiQueries
      • allowLocalInfile

        private java.lang.Boolean allowLocalInfile
      • useCompression

        private java.lang.Boolean useCompression
      • useAffectedRows

        private java.lang.Boolean useAffectedRows
      • useBulkStmts

        private java.lang.Boolean useBulkStmts
      • 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
      • blankTableNameMeta

        private java.lang.Boolean blankTableNameMeta
      • tinyInt1isBit

        private java.lang.Boolean tinyInt1isBit
      • 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
      • 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

      • 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
      • keyStorePassword

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

        public Configuration.Builder enabledSslProtocolSuites​(java.lang.String enabledSslProtocolSuites)
      • 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
      • 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
      • 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
      • 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)
      • transactionIsolation

        public Configuration.Builder transactionIsolation​(java.lang.String transactionIsolation)
      • enabledSslCipherSuites

        public Configuration.Builder enabledSslCipherSuites​(java.lang.String enabledSslCipherSuites)
      • sessionVariables

        public Configuration.Builder sessionVariables​(java.lang.String sessionVariables)
      • dumpQueriesOnException

        public Configuration.Builder dumpQueriesOnException​(java.lang.Boolean dumpQueriesOnException)
      • prepStmtCacheSize

        public Configuration.Builder prepStmtCacheSize​(java.lang.Integer prepStmtCacheSize)
      • useServerPrepStmts

        public Configuration.Builder useServerPrepStmts​(java.lang.Boolean useServerPrepStmts)
      • connectionAttributes

        public Configuration.Builder connectionAttributes​(java.lang.String connectionAttributes)
      • 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
      • includeInnodbStatusInDeadlockExceptions

        public Configuration.Builder includeInnodbStatusInDeadlockExceptions​(java.lang.Boolean includeInnodbStatusInDeadlockExceptions)
      • includeThreadDumpInDeadlockExceptions

        public Configuration.Builder includeThreadDumpInDeadlockExceptions​(java.lang.Boolean includeThreadDumpInDeadlockExceptions)
      • servicePrincipalName

        public Configuration.Builder servicePrincipalName​(java.lang.String servicePrincipalName)
      • defaultFetchSize

        public Configuration.Builder defaultFetchSize​(java.lang.Integer defaultFetchSize)
      • maxQuerySizeToLog

        public Configuration.Builder maxQuerySizeToLog​(java.lang.Integer maxQuerySizeToLog)
      • galeraAllowedState

        public Configuration.Builder galeraAllowedState​(java.lang.String galeraAllowedState)
      • poolValidMinDelay

        public Configuration.Builder poolValidMinDelay​(java.lang.Integer poolValidMinDelay)
      • useResetConnection

        public Configuration.Builder useResetConnection​(java.lang.Boolean useResetConnection)
      • serverRsaPublicKeyFile

        public Configuration.Builder serverRsaPublicKeyFile​(java.lang.String serverRsaPublicKeyFile)
      • allowPublicKeyRetrieval

        public Configuration.Builder allowPublicKeyRetrieval​(java.lang.Boolean allowPublicKeyRetrieval)
      • useReadAheadInput

        public Configuration.Builder useReadAheadInput​(java.lang.Boolean useReadAheadInput)
      • transactionReplay

        public Configuration.Builder transactionReplay​(java.lang.Boolean transactionReplay)
      • build

        public Configuration build()
                            throws java.sql.SQLException
        Throws:
        java.sql.SQLException