Package io.vertx.mssqlclient

## Class MSSQLConnectOptions

- java.lang.Object
- - io.vertx.sqlclient.SqlConnectOptions
  - - io.vertx.mssqlclient.MSSQLConnectOptions

-     public class MSSQLConnectOptions
      extends SqlConnectOptions

  Connect options for configuring `MSSQLConnection`.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static String` | `DEFAULT_APP_NAME` |
    `static String` | `DEFAULT_CLIENT_INTERFACE_NAME` |
    `static String` | `DEFAULT_DATABASE` |
    `static String` | `DEFAULT_HOST` |
    `static int` | `DEFAULT_PACKET_SIZE` |
    `static String` | `DEFAULT_PASSWORD` |
    `static int` | `DEFAULT_PORT` |
    `static Map<String,​String>` | `DEFAULT_PROPERTIES` |
    `static boolean` | `DEFAULT_SSL` |
    `static String` | `DEFAULT_USER` |
    `static int` | `MAX_PACKET_SIZE` |
    `static int` | `MIN_PACKET_SIZE` |

    - ### Fields inherited from class io.vertx.sqlclient.SqlConnectOptions

      `DEFAULT_CACHE_PREPARED_STATEMENTS, DEFAULT_METRICS_NAME, DEFAULT_PREPARED_STATEMENT_CACHE_FILTER, DEFAULT_PREPARED_STATEMENT_CACHE_MAX_SIZE, DEFAULT_PREPARED_STATEMENT_CACHE_SQL_LIMIT, DEFAULT_RECONNECT_ATTEMPTS, DEFAULT_RECONNECT_INTERVAL`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `MSSQLConnectOptions()` |
    `MSSQLConnectOptions​(JsonObject json)` |
    `MSSQLConnectOptions​(MSSQLConnectOptions other)` |
    `MSSQLConnectOptions​(SqlConnectOptions other)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `MSSQLConnectOptions` | `addProperty​(String key, String value)` | Add a property for this client, which will be sent to server at the connection start.
    `static MSSQLConnectOptions` | `fromUri​(String connectionUri)` | Provide a `MSSQLConnectOptions` configured from a connection URI.
    `int` | `getPacketSize()` | Get the desired size (in bytes) for TDS packets.
    `protected void` | `init()` | Initialize with the default options.
    `boolean` | `isSsl()` |
    `MSSQLConnectOptions` | `merge​(JsonObject other)` | Returns new options created after this object and merged with the `other` json config.
    `MSSQLConnectOptions` | `setCachePreparedStatements​(boolean cachePreparedStatements)` | Set whether prepared statements cache should be enabled.
    `MSSQLConnectOptions` | `setDatabase​(String database)` | Specify the default database for the connection.
    `MSSQLConnectOptions` | `setHost​(String host)` | Specify the host for connecting to the server.
    `MSSQLConnectOptions` | `setPacketSize​(int packetSize)` | Set the desired size (in bytes) for TDS packets.
    `MSSQLConnectOptions` | `setPassword​(String password)` | Specify the user password to be used for the authentication.
    `MSSQLConnectOptions` | `setPort​(int port)` | Specify the port for connecting to the server.
    `MSSQLConnectOptions` | `setPreparedStatementCacheMaxSize​(int preparedStatementCacheMaxSize)` | Set the maximum number of prepared statements that the connection will cache.
    `MSSQLConnectOptions` | `setPreparedStatementCacheSqlFilter​(Predicate<String> predicate)` | Set a predicate filtering prepared statements that the connection will cache.
    `MSSQLConnectOptions` | `setPreparedStatementCacheSqlLimit​(int preparedStatementCacheSqlLimit)` | Set the maximum length of prepared statement SQL string that the connection will cache.
    `MSSQLConnectOptions` | `setProperties​(Map<String,​String> properties)` | Set properties for this client, which will be sent to server at the connection start.
    `MSSQLConnectOptions` | `setReconnectAttempts​(int attempts)` | Set the value of reconnect attempts
    `MSSQLConnectOptions` | `setReconnectInterval​(long interval)` | Set the reconnect interval
    `MSSQLConnectOptions` | `setSsl​(boolean ssl)` | Set whether SSL/TLS is enabled
    `MSSQLConnectOptions` | `setSslOptions​(ClientSSLOptions sslOptions)` |
    `MSSQLConnectOptions` | `setUser​(String user)` | Specify the user account to be used for the authentication.
    `JsonObject` | `toJson()` |
    `static MSSQLConnectOptions` | `wrap​(SqlConnectOptions options)` |

    - ### Methods inherited from class io.vertx.sqlclient.SqlConnectOptions

      `getCachePreparedStatements, getDatabase, getHost, getMetricsName, getPassword, getPort, getPreparedStatementCacheMaxSize, getPreparedStatementCacheSqlFilter, getProperties, getReconnectAttempts, getReconnectInterval, getSocketAddress, getSslOptions, getTracingPolicy, getUser, isUsingDomainSocket, setMetricsName, setTracingPolicy`

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

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

- - ### Field Detail

    - #### DEFAULT_HOST

          public static final String DEFAULT_HOST

      See Also:
        Constant Field Values

    - #### DEFAULT_PORT

          public static final int DEFAULT_PORT

      See Also:
        Constant Field Values

    - #### DEFAULT_USER

          public static final String DEFAULT_USER

      See Also:
        Constant Field Values

    - #### DEFAULT_PASSWORD

          public static final String DEFAULT_PASSWORD

      See Also:
        Constant Field Values

    - #### DEFAULT_DATABASE

          public static final String DEFAULT_DATABASE

      See Also:
        Constant Field Values

    - #### DEFAULT_APP_NAME

          public static final String DEFAULT_APP_NAME

      See Also:
        Constant Field Values

    - #### DEFAULT_CLIENT_INTERFACE_NAME

          public static final String DEFAULT_CLIENT_INTERFACE_NAME

      See Also:
        Constant Field Values

    - #### DEFAULT_PROPERTIES

          public static final Map<String,​String> DEFAULT_PROPERTIES

    - #### MIN_PACKET_SIZE

          public static final int MIN_PACKET_SIZE

      See Also:
        Constant Field Values

    - #### MAX_PACKET_SIZE

          public static final int MAX_PACKET_SIZE

      See Also:
        Constant Field Values

    - #### DEFAULT_PACKET_SIZE

          public static final int DEFAULT_PACKET_SIZE

      See Also:
        Constant Field Values

    - #### DEFAULT_SSL

          public static final boolean DEFAULT_SSL

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### MSSQLConnectOptions

          public MSSQLConnectOptions()

    - #### MSSQLConnectOptions

          public MSSQLConnectOptions​(JsonObject json)

    - #### MSSQLConnectOptions

          public MSSQLConnectOptions​(SqlConnectOptions other)

    - #### MSSQLConnectOptions

          public MSSQLConnectOptions​(MSSQLConnectOptions other)

  - ### Method Detail

    - #### wrap

          public static MSSQLConnectOptions wrap​(SqlConnectOptions options)

      Returns:
        the `options` as MSSQL specific connect options

    - #### fromUri

          public static MSSQLConnectOptions fromUri​(String connectionUri)
                                             throws IllegalArgumentException

      Provide a `MSSQLConnectOptions` configured from a connection URI.
      Parameters:
        `connectionUri` - the connection URI to configure from
      Returns:
        a `MSSQLConnectOptions` parsed from the connection URI
      Throws:
        `IllegalArgumentException` - when the `connectionUri` is in an invalid format

    - #### setHost

          public MSSQLConnectOptions setHost​(String host)

      Description copied from class: `SqlConnectOptions`
      Specify the host for connecting to the server.
      Overrides:
        `setHost` in class `SqlConnectOptions`
      Parameters:
        `host` - the host to specify
      Returns:
        a reference to this, so the API can be used fluently

    - #### setPort

          public MSSQLConnectOptions setPort​(int port)

      Description copied from class: `SqlConnectOptions`
      Specify the port for connecting to the server.
      Overrides:
        `setPort` in class `SqlConnectOptions`
      Parameters:
        `port` - the port to specify
      Returns:
        a reference to this, so the API can be used fluently

    - #### setUser

          public MSSQLConnectOptions setUser​(String user)

      Description copied from class: `SqlConnectOptions`
      Specify the user account to be used for the authentication.
      Overrides:
        `setUser` in class `SqlConnectOptions`
      Parameters:
        `user` - the user to specify
      Returns:
        a reference to this, so the API can be used fluently

    - #### setPassword

          public MSSQLConnectOptions setPassword​(String password)

      Description copied from class: `SqlConnectOptions`
      Specify the user password to be used for the authentication.
      Overrides:
        `setPassword` in class `SqlConnectOptions`
      Parameters:
        `password` - the password to specify
      Returns:
        a reference to this, so the API can be used fluently

    - #### setDatabase

          public MSSQLConnectOptions setDatabase​(String database)

      Description copied from class: `SqlConnectOptions`
      Specify the default database for the connection.
      Overrides:
        `setDatabase` in class `SqlConnectOptions`
      Parameters:
        `database` - the database name to specify
      Returns:
        a reference to this, so the API can be used fluently

    - #### setProperties

          public MSSQLConnectOptions setProperties​(Map<String,​String> properties)

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

    - #### addProperty

          public MSSQLConnectOptions addProperty​(String key,
                                                 String value)

      Description copied from class: `SqlConnectOptions`
      Add a property for this client, which will be sent to server at the connection start.
      Overrides:
        `addProperty` in class `SqlConnectOptions`
      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

    - #### getPacketSize

          public int getPacketSize()

      Get the desired size (in bytes) for TDS packets.
      Returns:
        the desired packet size

    - #### setPacketSize

          public MSSQLConnectOptions setPacketSize​(int packetSize)

      Set the desired size (in bytes) for TDS packets.

      The client will use the value as a parameter in the LOGIN7 packet. The server may or may not accept it.

      Parameters:
        `packetSize` - the desired packet size (in bytes)
      Returns:
        a reference to this, so the API can be used fluently
      Throws:
        `IllegalArgumentException` - if `packetSize` is smaller than `MIN_PACKET_SIZE` or bigger than `MAX_PACKET_SIZE`

    - #### isSsl

          public boolean isSsl()

      Returns:
        is SSL/TLS enabled?

    - #### setSsl

          public MSSQLConnectOptions setSsl​(boolean ssl)

      Set whether SSL/TLS is enabled
      Parameters:
        `ssl` - true if enabled
      Returns:
        a reference to this, so the API can be used fluently

    - #### setReconnectAttempts

          public MSSQLConnectOptions setReconnectAttempts​(int attempts)

      Description copied from class: `SqlConnectOptions`
      Set the value of reconnect attempts
      Overrides:
        `setReconnectAttempts` in class `SqlConnectOptions`
      Parameters:
        `attempts` - the maximum number of reconnect attempts
      Returns:
        a reference to this, so the API can be used fluently

    - #### setReconnectInterval

          public MSSQLConnectOptions setReconnectInterval​(long interval)

      Description copied from class: `SqlConnectOptions`
      Set the reconnect interval
      Overrides:
        `setReconnectInterval` in class `SqlConnectOptions`
      Parameters:
        `interval` - the reconnect interval in ms
      Returns:
        a reference to this, so the API can be used fluently

    - #### setCachePreparedStatements

          public MSSQLConnectOptions setCachePreparedStatements​(boolean cachePreparedStatements)

      Description copied from class: `SqlConnectOptions`
      Set whether prepared statements cache should be enabled.
      Overrides:
        `setCachePreparedStatements` in class `SqlConnectOptions`
      Parameters:
        `cachePreparedStatements` - true if cache should be enabled
      Returns:
        a reference to this, so the API can be used fluently

    - #### setPreparedStatementCacheMaxSize

          public MSSQLConnectOptions setPreparedStatementCacheMaxSize​(int preparedStatementCacheMaxSize)

      Description copied from class: `SqlConnectOptions`
      Set the maximum number of prepared statements that the connection will cache.
      Overrides:
        `setPreparedStatementCacheMaxSize` in class `SqlConnectOptions`
      Parameters:
        `preparedStatementCacheMaxSize` - the size to set
      Returns:
        a reference to this, so the API can be used fluently

    - #### setPreparedStatementCacheSqlFilter

          public MSSQLConnectOptions setPreparedStatementCacheSqlFilter​(Predicate<String> predicate)

      Description copied from class: `SqlConnectOptions`
      Set a predicate filtering prepared statements that the connection will cache.

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

      Overrides:
        `setPreparedStatementCacheSqlFilter` in class `SqlConnectOptions`
      Parameters:
        `predicate` - the filter

    - #### setPreparedStatementCacheSqlLimit

          public MSSQLConnectOptions setPreparedStatementCacheSqlLimit​(int preparedStatementCacheSqlLimit)

      Description copied from class: `SqlConnectOptions`
      Set the maximum length of prepared statement SQL string that the connection will cache.

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

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

    - #### setSslOptions

          public MSSQLConnectOptions setSslOptions​(ClientSSLOptions sslOptions)

      Overrides:
        `setSslOptions` in class `SqlConnectOptions`

    - #### init

          protected void init()

      Initialize with the default options.
      Overrides:
        `init` in class `SqlConnectOptions`

    - #### toJson

          public JsonObject toJson()

      Overrides:
        `toJson` in class `SqlConnectOptions`

    - #### merge

          public MSSQLConnectOptions merge​(JsonObject other)

      Description copied from class: `SqlConnectOptions`
      Returns new options created after this object and merged with the `other` json config.
      Overrides:
        `merge` in class `SqlConnectOptions`
      Parameters:
        `other` - the other JSON object
      Returns:
        new options created after this object and merged with the `other` json config