Package org.mariadb.jdbc

## Class Configuration.Builder

- java.lang.Object
- - org.mariadb.jdbc.Configuration.Builder

All Implemented Interfaces:
  `Cloneable`

Enclosing class:
  Configuration

    public static final class Configuration.Builder
    extends Object
    implements Cloneable

A builder for `Configuration` instances.

### Constructor Summary

Constructors
`Builder()`

### Method Summary

All Methods Instance Methods Concrete Methods
`Configuration.Builder` `addHost​(String host, int port)`
`Configuration.Builder` `addHost​(String host, int port, boolean master)`
`Configuration.Builder` `addresses​(HostAddress... hostAddress)`
`Configuration.Builder` `allowLocalInfile​(Boolean allowLocalInfile)` Indicate if LOAD DATA LOCAL INFILE are permitted.
`Configuration.Builder` `allowMultiQueries​(Boolean allowMultiQueries)` Indicate that multi-queries are allowed.
`Configuration.Builder` `allowPublicKeyRetrieval​(Boolean allowPublicKeyRetrieval)`
`Configuration.Builder` `autocommit​(Boolean autocommit)`
`Configuration.Builder` `blankTableNameMeta​(Boolean blankTableNameMeta)`
`Configuration` `build()`
`Configuration.Builder` `cachePrepStmts​(Boolean cachePrepStmts)`
`Configuration.Builder` `connectionAttributes​(String connectionAttributes)`
`Configuration.Builder` `connectTimeout​(Integer connectTimeout)` Indicate connect timeout value, in milliseconds, or zero for no timeout.
`Configuration.Builder` `credentialType​(String credentialType)`
`Configuration.Builder` `database​(String database)`
`Configuration.Builder` `defaultFetchSize​(Integer defaultFetchSize)`
`Configuration.Builder` `dumpQueriesOnException​(Boolean dumpQueriesOnException)`
`Configuration.Builder` `enabledSslCipherSuites​(String enabledSslCipherSuites)`
`Configuration.Builder` `enabledSslProtocolSuites​(String enabledSslProtocolSuites)`
`Configuration.Builder` `galeraAllowedState​(String galeraAllowedState)`
`Configuration.Builder` `geometryDefaultType​(String geometryDefault)` Indicate what default Object type Geometry a resultset.getObject must return.
`Configuration.Builder` `haMode​(HaMode haMode)`
`Configuration.Builder` `includeInnodbStatusInDeadlockExceptions​(Boolean includeInnodbStatusInDeadlockExceptions)`
`Configuration.Builder` `includeThreadDumpInDeadlockExceptions​(Boolean includeThreadDumpInDeadlockExceptions)`
`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)
`Configuration.Builder` `keyStorePassword​(String keyStorePassword)` Client keystore password
`Configuration.Builder` `keyStoreType​(String keyStoreType)`
`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).
`Configuration.Builder` `localSocketAddress​(String localSocketAddress)` Indicate Hostname or IP address to bind the connection socket to a local (UNIX domain) socket.
`Configuration.Builder` `maxIdleTime​(Integer maxIdleTime)`
`Configuration.Builder` `maxPoolSize​(Integer maxPoolSize)`
`Configuration.Builder` `maxQuerySizeToLog​(Integer maxQuerySizeToLog)`
`Configuration.Builder` `minPoolSize​(Integer minPoolSize)`
`Configuration.Builder` `password​(String password)`
`Configuration.Builder` `pipe​(String pipe)` Indicate to use windows named pipe, specify named pipe name to connect
`Configuration.Builder` `pool​(Boolean pool)`
`Configuration.Builder` `poolName​(String poolName)`
`Configuration.Builder` `poolValidMinDelay​(Integer poolValidMinDelay)`
`Configuration.Builder` `prepStmtCacheSize​(Integer prepStmtCacheSize)`
`Configuration.Builder` `registerJmxPool​(Boolean registerJmxPool)`
`Configuration.Builder` `restrictedAuth​(String restrictedAuth)` restrict authentication method to secure list.
`Configuration.Builder` `retriesAllDown​(Integer retriesAllDown)`
`Configuration.Builder` `serverRsaPublicKeyFile​(String serverRsaPublicKeyFile)`
`Configuration.Builder` `serverSslCert​(String serverSslCert)`
`Configuration.Builder` `servicePrincipalName​(String servicePrincipalName)`
`Configuration.Builder` `sessionVariables​(String sessionVariables)`
`Configuration.Builder` `socketFactory​(String socketFactory)`
`Configuration.Builder` `socketTimeout​(Integer socketTimeout)` Indicate the network socket timeout (SO_TIMEOUT) in milliseconds.
`Configuration.Builder` `sslMode​(String sslMode)`
`Configuration.Builder` `tcpAbortiveClose​(Boolean tcpAbortiveClose)` Indicate that when connection fails, to send an RST TCP packet.
`Configuration.Builder` `tcpKeepAlive​(Boolean tcpKeepAlive)` Indicate if TCP keep-alive must be enable.
`Configuration.Builder` `tcpKeepCount​(Integer tcpKeepCount)` Indicate TCP keep-count value (for java 11+ only).
`Configuration.Builder` `tcpKeepIdle​(Integer tcpKeepIdle)` Indicate TCP keep-idle value (for java 11+ only).
`Configuration.Builder` `tcpKeepInterval​(Integer tcpKeepInterval)` Indicate TCP keep-interval value (for java 11+ only).
`Configuration.Builder` `timezone​(String timezone)`
`Configuration.Builder` `tinyInt1isBit​(Boolean tinyInt1isBit)`
`Configuration.Builder` `tlsSocketType​(String tlsSocketType)`
`Configuration.Builder` `transactionIsolation​(String transactionIsolation)`
`Configuration.Builder` `transactionReplay​(Boolean transactionReplay)`
`Configuration.Builder` `useAffectedRows​(Boolean useAffectedRows)`
`Configuration.Builder` `useBulkStmts​(Boolean useBulkStmts)`
`Configuration.Builder` `useCompression​(Boolean useCompression)` Indicate to compresses exchanges with the database through gzip.
`Configuration.Builder` `user​(String user)`
`Configuration.Builder` `useReadAheadInput​(Boolean useReadAheadInput)`
`Configuration.Builder` `useResetConnection​(Boolean useResetConnection)`
`Configuration.Builder` `useServerPrepStmts​(Boolean useServerPrepStmts)`
`Configuration.Builder` `yearIsDateType​(Boolean yearIsDateType)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### Builder

    public Builder()

### Method Detail

#### user

    public Configuration.Builder user​(String user)

#### serverSslCert

    public Configuration.Builder serverSslCert​(String serverSslCert)

#### 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`

#### keyStorePassword

    public Configuration.Builder keyStorePassword​(String keyStorePassword)

Client keystore password

Parameters:
  `keyStorePassword` - client store password
Returns:
  this `Configuration.Builder`

#### keyStoreType

    public Configuration.Builder keyStoreType​(String keyStoreType)

#### password

    public Configuration.Builder password​(String password)

#### enabledSslProtocolSuites

    public Configuration.Builder enabledSslProtocolSuites​(String enabledSslProtocolSuites)

#### database

    public Configuration.Builder database​(String database)

#### haMode

    public Configuration.Builder haMode​(HaMode haMode)

#### addHost

    public Configuration.Builder addHost​(String host,
                                         int port)

#### addHost

    public Configuration.Builder addHost​(String host,
                                         int port,
                                         boolean master)

#### addresses

    public Configuration.Builder addresses​(HostAddress... hostAddress)

#### socketFactory

    public Configuration.Builder socketFactory​(String socketFactory)

#### 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`

#### pipe

    public Configuration.Builder pipe​(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​(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`

#### tcpKeepAlive

    public Configuration.Builder tcpKeepAlive​(Boolean tcpKeepAlive)

Indicate if TCP keep-alive must be enable.

Parameters:
  `tcpKeepAlive` - value
Returns:
  this `Configuration.Builder`

#### tcpKeepIdle

    public Configuration.Builder tcpKeepIdle​(Integer tcpKeepIdle)

Indicate TCP keep-idle value (for java 11+ only).

Parameters:
  `tcpKeepIdle` - value
Returns:
  this `Configuration.Builder`

#### tcpKeepCount

    public Configuration.Builder tcpKeepCount​(Integer tcpKeepCount)

Indicate TCP keep-count value (for java 11+ only).

Parameters:
  `tcpKeepCount` - value
Returns:
  this `Configuration.Builder`

#### tcpKeepInterval

    public Configuration.Builder tcpKeepInterval​(Integer tcpKeepInterval)

Indicate TCP keep-interval value (for java 11+ only).

Parameters:
  `tcpKeepInterval` - value
Returns:
  this `Configuration.Builder`

#### tcpAbortiveClose

    public Configuration.Builder tcpAbortiveClose​(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​(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 compresses 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)

#### credentialType

    public Configuration.Builder credentialType​(String credentialType)

#### sslMode

    public Configuration.Builder sslMode​(String sslMode)

#### transactionIsolation

    public Configuration.Builder transactionIsolation​(String transactionIsolation)

#### enabledSslCipherSuites

    public Configuration.Builder enabledSslCipherSuites​(String enabledSslCipherSuites)

#### sessionVariables

    public Configuration.Builder sessionVariables​(String sessionVariables)

#### tinyInt1isBit

    public Configuration.Builder tinyInt1isBit​(Boolean tinyInt1isBit)

#### yearIsDateType

    public Configuration.Builder yearIsDateType​(Boolean yearIsDateType)

#### timezone

    public Configuration.Builder timezone​(String timezone)

#### dumpQueriesOnException

    public Configuration.Builder dumpQueriesOnException​(Boolean dumpQueriesOnException)

#### prepStmtCacheSize

    public Configuration.Builder prepStmtCacheSize​(Integer prepStmtCacheSize)

#### useAffectedRows

    public Configuration.Builder useAffectedRows​(Boolean useAffectedRows)

#### useServerPrepStmts

    public Configuration.Builder useServerPrepStmts​(Boolean useServerPrepStmts)

#### connectionAttributes

    public Configuration.Builder connectionAttributes​(String connectionAttributes)

#### useBulkStmts

    public Configuration.Builder useBulkStmts​(Boolean useBulkStmts)

#### autocommit

    public Configuration.Builder autocommit​(Boolean autocommit)

#### includeInnodbStatusInDeadlockExceptions

    public Configuration.Builder includeInnodbStatusInDeadlockExceptions​(Boolean includeInnodbStatusInDeadlockExceptions)

#### includeThreadDumpInDeadlockExceptions

    public Configuration.Builder includeThreadDumpInDeadlockExceptions​(Boolean includeThreadDumpInDeadlockExceptions)

#### servicePrincipalName

    public Configuration.Builder servicePrincipalName​(String servicePrincipalName)

#### defaultFetchSize

    public Configuration.Builder defaultFetchSize​(Integer defaultFetchSize)

#### tlsSocketType

    public Configuration.Builder tlsSocketType​(String tlsSocketType)

#### maxQuerySizeToLog

    public Configuration.Builder maxQuerySizeToLog​(Integer maxQuerySizeToLog)

#### retriesAllDown

    public Configuration.Builder retriesAllDown​(Integer retriesAllDown)

#### galeraAllowedState

    public Configuration.Builder galeraAllowedState​(String galeraAllowedState)

#### pool

    public Configuration.Builder pool​(Boolean pool)

#### poolName

    public Configuration.Builder poolName​(String poolName)

#### maxPoolSize

    public Configuration.Builder maxPoolSize​(Integer maxPoolSize)

#### minPoolSize

    public Configuration.Builder minPoolSize​(Integer minPoolSize)

#### maxIdleTime

    public Configuration.Builder maxIdleTime​(Integer maxIdleTime)

#### registerJmxPool

    public Configuration.Builder registerJmxPool​(Boolean registerJmxPool)

#### poolValidMinDelay

    public Configuration.Builder poolValidMinDelay​(Integer poolValidMinDelay)

#### useResetConnection

    public Configuration.Builder useResetConnection​(Boolean useResetConnection)

#### serverRsaPublicKeyFile

    public Configuration.Builder serverRsaPublicKeyFile​(String serverRsaPublicKeyFile)

#### allowPublicKeyRetrieval

    public Configuration.Builder allowPublicKeyRetrieval​(Boolean allowPublicKeyRetrieval)

#### useReadAheadInput

    public Configuration.Builder useReadAheadInput​(Boolean useReadAheadInput)

#### cachePrepStmts

    public Configuration.Builder cachePrepStmts​(Boolean cachePrepStmts)

#### transactionReplay

    public Configuration.Builder transactionReplay​(Boolean transactionReplay)

#### build

    public Configuration build()
                        throws SQLException

Throws:
  `SQLException`