io.vertx.sqlclient

## Class SqlConnectOptions

- java.lang.Object
- - io.vertx.core.net.NetworkOptions
  - - io.vertx.core.net.TCPSSLOptions
    - - io.vertx.core.net.ClientOptionsBase
      - - io.vertx.core.net.NetClientOptions
        - - io.vertx.sqlclient.SqlConnectOptions

- Direct Known Subclasses:
    MySQLConnectOptions, PgConnectOptions

      public class SqlConnectOptions
      extends NetClientOptions

  Connect options for configuring `SqlConnection` or `Pool`.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static boolean` | `DEFAULT_CACHE_PREPARED_STATEMENTS`
    `static java.util.function.Predicate<String>` | `DEFAULT_PREPARED_STATEMENT_CACHE_FILTER`
    `static int` | `DEFAULT_PREPARED_STATEMENT_CACHE_MAX_SIZE`
    `static int` | `DEFAULT_PREPARED_STATEMENT_CACHE_SQL_LIMIT`

    - ### Fields inherited from class io.vertx.core.net.NetClientOptions

      `DEFAULT_HOSTNAME_VERIFICATION_ALGORITHM, DEFAULT_RECONNECT_ATTEMPTS, DEFAULT_RECONNECT_INTERVAL`

    - ### Fields inherited from class io.vertx.core.net.ClientOptionsBase

      `DEFAULT_CONNECT_TIMEOUT, DEFAULT_METRICS_NAME, DEFAULT_TRUST_ALL`

    - ### Fields inherited from class io.vertx.core.net.TCPSSLOptions

      `DEFAULT_ENABLED_SECURE_TRANSPORT_PROTOCOLS, DEFAULT_IDLE_TIMEOUT, DEFAULT_IDLE_TIMEOUT_TIME_UNIT, DEFAULT_SO_LINGER, DEFAULT_SSL, DEFAULT_SSL_ENGINE, DEFAULT_SSL_HANDSHAKE_TIMEOUT, DEFAULT_SSL_HANDSHAKE_TIMEOUT_TIME_UNIT, DEFAULT_TCP_CORK, DEFAULT_TCP_FAST_OPEN, DEFAULT_TCP_KEEP_ALIVE, DEFAULT_TCP_NO_DELAY, DEFAULT_TCP_QUICKACK, DEFAULT_USE_ALPN`

    - ### Fields inherited from class io.vertx.core.net.NetworkOptions

      `DEFAULT_LOG_ENABLED, DEFAULT_RECEIVE_BUFFER_SIZE, DEFAULT_REUSE_ADDRESS, DEFAULT_REUSE_PORT, DEFAULT_SEND_BUFFER_SIZE, DEFAULT_TRAFFIC_CLASS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SqlConnectOptions()`
    `SqlConnectOptions(JsonObject json)`
    `SqlConnectOptions(SqlConnectOptions other)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `SqlConnectOptions` | `addProperty(String key, String value)` Add a property for this client, which will be sent to server at the connection start.
    `boolean` | `getCachePreparedStatements()` Get whether prepared statements cache is enabled.
    `String` | `getDatabase()` Get the default database name for the connection.
    `String` | `getHost()` Get the host for connecting to the server.
    `String` | `getPassword()` Get the user password to be used for the authentication.
    `int` | `getPort()` Get the port for connecting to the server.
    `int` | `getPreparedStatementCacheMaxSize()` Get the maximum number of prepared statements that the connection will cache.
    `java.util.function.Predicate<String>` | `getPreparedStatementCacheSqlFilter()` Get the predicate filtering prepared statements that the connection will cache.
    `Map<String,String>` | `getProperties()`
    `SocketAddress` | `getSocketAddress()`
    `String` | `getUser()` Get the user account to be used for the authentication.
    `protected void` | `init()` Initialize with the default options.
    `SqlConnectOptions` | `setCachePreparedStatements(boolean cachePreparedStatements)` Set whether prepared statements cache should be enabled.
    `SqlConnectOptions` | `setDatabase(String database)` Specify the default database for the connection.
    `SqlConnectOptions` | `setHost(String host)` Specify the host for connecting to the server.
    `SqlConnectOptions` | `setPassword(String password)` Specify the user password to be used for the authentication.
    `SqlConnectOptions` | `setPort(int port)` Specify the port for connecting to the server.
    `SqlConnectOptions` | `setPreparedStatementCacheMaxSize(int preparedStatementCacheMaxSize)` Set the maximum number of prepared statements that the connection will cache.
    `SqlConnectOptions` | `setPreparedStatementCacheSqlFilter(java.util.function.Predicate<String> predicate)` Set a predicate filtering prepared statements that the connection will cache.
    `SqlConnectOptions` | `setPreparedStatementCacheSqlLimit(int preparedStatementCacheSqlLimit)` Set the maximum length of prepared statement SQL string that the connection will cache.
    `SqlConnectOptions` | `setProperties(Map<String,String> properties)` Set properties for this client, which will be sent to server at the connection start.
    `SqlConnectOptions` | `setUser(String user)` Specify the user account to be used for the authentication.
    `JsonObject` | `toJson()` Convert to JSON

    - ### Methods inherited from class io.vertx.core.net.NetClientOptions

      `addCrlPath, addCrlValue, addEnabledCipherSuite, addEnabledSecureTransportProtocol, getHostnameVerificationAlgorithm, getReconnectAttempts, getReconnectInterval, removeEnabledSecureTransportProtocol, setConnectTimeout, setEnabledSecureTransportProtocols, setHostnameVerificationAlgorithm, setIdleTimeout, setIdleTimeoutUnit, setJdkSslEngineOptions, setKeyCertOptions, setKeyStoreOptions, setLocalAddress, setLogActivity, setMetricsName, setOpenSslEngineOptions, setPemKeyCertOptions, setPemTrustOptions, setPfxKeyCertOptions, setPfxTrustOptions, setProxyOptions, setReceiveBufferSize, setReconnectAttempts, setReconnectInterval, setReuseAddress, setReusePort, setSendBufferSize, setSoLinger, setSsl, setSslEngineOptions, setSslHandshakeTimeout, setSslHandshakeTimeoutUnit, setTcpCork, setTcpFastOpen, setTcpKeepAlive, setTcpNoDelay, setTcpQuickAck, setTrafficClass, setTrustAll, setTrustOptions, setTrustStoreOptions, setUseAlpn`

    - ### Methods inherited from class io.vertx.core.net.ClientOptionsBase

      `getConnectTimeout, getLocalAddress, getMetricsName, getProxyOptions, isTrustAll`

    - ### Methods inherited from class io.vertx.core.net.TCPSSLOptions

      `getCrlPaths, getCrlValues, getEnabledCipherSuites, getEnabledSecureTransportProtocols, getIdleTimeout, getIdleTimeoutUnit, getJdkSslEngineOptions, getKeyCertOptions, getKeyStoreOptions, getOpenSslEngineOptions, getPemKeyCertOptions, getPemTrustOptions, getPfxKeyCertOptions, getPfxTrustOptions, getSoLinger, getSslEngineOptions, getSslHandshakeTimeout, getSslHandshakeTimeoutUnit, getTrustOptions, getTrustStoreOptions, isSsl, isTcpCork, isTcpFastOpen, isTcpKeepAlive, isTcpNoDelay, isTcpQuickAck, isUseAlpn`

    - ### Methods inherited from class io.vertx.core.net.NetworkOptions

      `getLogActivity, getReceiveBufferSize, getSendBufferSize, getTrafficClass, isReuseAddress, isReusePort`

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

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

- - ### Field Detail

    - #### DEFAULT_CACHE_PREPARED_STATEMENTS

          public static final boolean DEFAULT_CACHE_PREPARED_STATEMENTS

      See Also:
        Constant Field Values

    - #### DEFAULT_PREPARED_STATEMENT_CACHE_MAX_SIZE

          public static final int DEFAULT_PREPARED_STATEMENT_CACHE_MAX_SIZE

      See Also:
        Constant Field Values

    - #### DEFAULT_PREPARED_STATEMENT_CACHE_SQL_LIMIT

          public static final int DEFAULT_PREPARED_STATEMENT_CACHE_SQL_LIMIT

      See Also:
        Constant Field Values

    - #### DEFAULT_PREPARED_STATEMENT_CACHE_FILTER

          public static final java.util.function.Predicate<String> DEFAULT_PREPARED_STATEMENT_CACHE_FILTER

  - ### Constructor Detail

    - #### SqlConnectOptions

          public SqlConnectOptions()

    - #### SqlConnectOptions

          public SqlConnectOptions(JsonObject json)

    - #### SqlConnectOptions

          public SqlConnectOptions(SqlConnectOptions other)

  - ### Method Detail

    - #### getHost

          public String getHost()

      Get the host for connecting to the server.
      Returns:
        the host

    - #### setHost

          public SqlConnectOptions setHost(String host)

      Specify the host for connecting to the server.
      Parameters:
        `host` - the host to specify
      Returns:
        a reference to this, so the API can be used fluently

    - #### getPort

          public int getPort()

      Get the port for connecting to the server.
      Returns:
        the port

    - #### setPort

          public SqlConnectOptions setPort(int port)

      Specify the port for connecting to the server.
      Parameters:
        `port` - the port to specify
      Returns:
        a reference to this, so the API can be used fluently

    - #### getUser

          public String getUser()

      Get the user account to be used for the authentication.
      Returns:
        the user

    - #### setUser

          public SqlConnectOptions setUser(String user)

      Specify the user account to be used for the authentication.
      Parameters:
        `user` - the user to specify
      Returns:
        a reference to this, so the API can be used fluently

    - #### getPassword

          public String getPassword()

      Get the user password to be used for the authentication.
      Returns:
        the password

    - #### setPassword

          public SqlConnectOptions setPassword(String password)

      Specify the user password to be used for the authentication.
      Parameters:
        `password` - the password to specify
      Returns:
        a reference to this, so the API can be used fluently

    - #### getDatabase

          public String getDatabase()

      Get the default database name for the connection.
      Returns:
        the database name

    - #### setDatabase

          public SqlConnectOptions setDatabase(String database)

      Specify the default database for the connection.
      Parameters:
        `database` - the database name to specify
      Returns:
        a reference to this, so the API can be used fluently

    - #### getCachePreparedStatements

          public boolean getCachePreparedStatements()

      Get whether prepared statements cache is enabled.
      Returns:
        the value

    - #### setCachePreparedStatements

          public SqlConnectOptions setCachePreparedStatements(boolean cachePreparedStatements)

      Set whether prepared statements cache should be enabled.
      Parameters:
        `cachePreparedStatements` - true if cache should be enabled
      Returns:
        a reference to this, so the API can be used fluently

    - #### getPreparedStatementCacheMaxSize

          public int getPreparedStatementCacheMaxSize()

      Get the maximum number of prepared statements that the connection will cache.
      Returns:
        the size

    - #### setPreparedStatementCacheMaxSize

          public SqlConnectOptions setPreparedStatementCacheMaxSize(int preparedStatementCacheMaxSize)

      Set the maximum number of prepared statements that the connection will cache.
      Parameters:
        `preparedStatementCacheMaxSize` - the size to set
      Returns:
        a reference to this, so the API can be used fluently

    - #### getPreparedStatementCacheSqlFilter

          public java.util.function.Predicate<String> getPreparedStatementCacheSqlFilter()

      Get the predicate filtering prepared statements that the connection will cache.
      Returns:
        the current predicate

    - #### setPreparedStatementCacheSqlFilter

          public SqlConnectOptions setPreparedStatementCacheSqlFilter(java.util.function.Predicate<String> predicate)

      Set a predicate filtering prepared statements that the connection will cache.

      The default predicate accepts predicate having query length < `DEFAULT_PREPARED_STATEMENT_CACHE_SQL_LIMIT`

      Parameters:
        `predicate` - the filter

    - #### setPreparedStatementCacheSqlLimit

          public SqlConnectOptions setPreparedStatementCacheSqlLimit(int preparedStatementCacheSqlLimit)

      Set the maximum length of prepared statement SQL string that the connection will cache.

      This is an helper setting the `setPreparedStatementCacheSqlFilter(Predicate)`.

      Parameters:
        `preparedStatementCacheSqlLimit` - the maximum length limit of SQL string to set
      Returns:
        a reference to this, so the API can be used fluently

    - #### getProperties

          public Map<String,String> getProperties()

      Returns:
        the value of current connection properties

    - #### setProperties

          public SqlConnectOptions setProperties(Map<String,String> properties)

      Set properties for this client, which will be sent to server at the connection start.
      Parameters:
        `properties` - the value of properties to specify
      Returns:
        a reference to this, so the API can be used fluently

    - #### addProperty

          public SqlConnectOptions addProperty(String key,
                                               String value)

      Add a property for this client, which will be sent to server at the connection start.
      Parameters:
        `key` - the value of property key
        `value` - the value of property value
      Returns:
        a reference to this, so the API can be used fluently

    - #### getSocketAddress

          public SocketAddress getSocketAddress()

    - #### toJson

          public JsonObject toJson()

      Description copied from class: `ClientOptionsBase`
      Convert to JSON
      Overrides:
        `toJson` in class `ClientOptionsBase`
      Returns:
        the JSON

    - #### init

          protected void init()

      Initialize with the default options.

Copyright © 2020 Eclipse. All rights reserved.