Class MSSQLConnectOptions
java.lang.Object
io.vertx.sqlclient.SqlConnectOptions
io.vertx.mssqlclient.MSSQLConnectOptions
Connect options for configuring
MSSQLConnection.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionaddProperty(String key, String value) Add a property for this client, which will be sent to server at the connection start.static MSSQLConnectOptionsProvide aMSSQLConnectOptionsconfigured from a connection URI.Get the encryption mode for the connection.intGet the desired size (in bytes) for TDS packets.protected voidinit()Initialize with the default options.booleanisSsl()merge(JsonObject other) Returns new options created after this object and merged with theotherjson config.setCachePreparedStatements(boolean cachePreparedStatements) Set whether prepared statements cache should be enabled.setDatabase(String database) Specify the default database for the connection.setEncryptionMode(EncryptionMode encryptionMode) Set the encryption mode for the connection.Specify the host for connecting to the server.setPacketSize(int packetSize) Set the desired size (in bytes) for TDS packets.setPassword(String password) Specify the user password to be used for the authentication.setPort(int port) Specify the port for connecting to the server.setPreparedStatementCacheMaxSize(int preparedStatementCacheMaxSize) Set the maximum number of prepared statements that the connection will cache.setPreparedStatementCacheSqlFilter(Predicate<String> predicate) Set a predicate filtering prepared statements that the connection will cache.setPreparedStatementCacheSqlLimit(int preparedStatementCacheSqlLimit) Set the maximum length of prepared statement SQL string that the connection will cache.setProperties(Map<String, String> properties) Set properties for this client, which will be sent to server at the connection start.setReconnectAttempts(int attempts) Set the value of reconnect attemptssetReconnectInterval(long interval) Set the reconnect intervalsetSsl(boolean ssl) Set whether SSL/TLS is enabledsetSslOptions(ClientSSLOptions sslOptions) Specify the user account to be used for the authentication.toJson()static MSSQLConnectOptionswrap(SqlConnectOptions options) Methods inherited from class SqlConnectOptions
getCachePreparedStatements, getDatabase, getHost, getMetricsName, getPassword, getPort, getPreparedStatementCacheMaxSize, getPreparedStatementCacheSqlFilter, getProperties, getReconnectAttempts, getReconnectInterval, getSocketAddress, getSslOptions, getTracingPolicy, getUser, isUsingDomainSocket, setMetricsName, setTracingPolicy
-
Field Details
-
DEFAULT_HOST
- See Also:
-
DEFAULT_PORT
public static final int DEFAULT_PORT- See Also:
-
DEFAULT_USER
- See Also:
-
DEFAULT_PASSWORD
- See Also:
-
DEFAULT_DATABASE
- See Also:
-
DEFAULT_APP_NAME
- See Also:
-
DEFAULT_CLIENT_INTERFACE_NAME
- See Also:
-
DEFAULT_PROPERTIES
-
MIN_PACKET_SIZE
public static final int MIN_PACKET_SIZE- See Also:
-
MAX_PACKET_SIZE
public static final int MAX_PACKET_SIZE- See Also:
-
DEFAULT_PACKET_SIZE
public static final int DEFAULT_PACKET_SIZE- See Also:
-
DEFAULT_SSL
public static final boolean DEFAULT_SSL- See Also:
-
DEFAULT_ENCRYPTION_MODE
-
-
Constructor Details
-
MSSQLConnectOptions
public MSSQLConnectOptions() -
MSSQLConnectOptions
-
MSSQLConnectOptions
-
MSSQLConnectOptions
-
-
Method Details
-
wrap
- Returns:
- the
optionsas MSSQL specific connect options
-
fromUri
Provide aMSSQLConnectOptionsconfigured from a connection URI.- Parameters:
connectionUri- the connection URI to configure from- Returns:
- a
MSSQLConnectOptionsparsed from the connection URI - Throws:
IllegalArgumentException- when theconnectionUriis in an invalid format
-
setHost
Description copied from class:SqlConnectOptionsSpecify the host for connecting to the server.- Overrides:
setHostin classSqlConnectOptions- Parameters:
host- the host to specify- Returns:
- a reference to this, so the API can be used fluently
-
setPort
Description copied from class:SqlConnectOptionsSpecify the port for connecting to the server.- Overrides:
setPortin classSqlConnectOptions- Parameters:
port- the port to specify- Returns:
- a reference to this, so the API can be used fluently
-
setUser
Description copied from class:SqlConnectOptionsSpecify the user account to be used for the authentication.- Overrides:
setUserin classSqlConnectOptions- Parameters:
user- the user to specify- Returns:
- a reference to this, so the API can be used fluently
-
setPassword
Description copied from class:SqlConnectOptionsSpecify the user password to be used for the authentication.- Overrides:
setPasswordin classSqlConnectOptions- Parameters:
password- the password to specify- Returns:
- a reference to this, so the API can be used fluently
-
setDatabase
Description copied from class:SqlConnectOptionsSpecify the default database for the connection.- Overrides:
setDatabasein classSqlConnectOptions- Parameters:
database- the database name to specify- Returns:
- a reference to this, so the API can be used fluently
-
setProperties
Description copied from class:SqlConnectOptionsSet properties for this client, which will be sent to server at the connection start.- Overrides:
setPropertiesin classSqlConnectOptions- Parameters:
properties- the value of properties to specify- Returns:
- a reference to this, so the API can be used fluently
-
addProperty
Description copied from class:SqlConnectOptionsAdd a property for this client, which will be sent to server at the connection start.- Overrides:
addPropertyin classSqlConnectOptions- Parameters:
key- the value of property keyvalue- 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
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- ifpacketSizeis smaller thanMIN_PACKET_SIZEor bigger thanMAX_PACKET_SIZE
-
isSsl
public boolean isSsl()- Returns:
- is SSL/TLS enabled?
-
setSsl
Set whether SSL/TLS is enabled- Parameters:
ssl- true if enabled- Returns:
- a reference to this, so the API can be used fluently
-
getEncryptionMode
Get the encryption mode for the connection.- Returns:
- the encryption mode
-
setEncryptionMode
Set the encryption mode for the connection.Determines which version of the TDS protocol to use for encryption:
EncryptionMode.OFF- No encryption (TDS 7.x, default)EncryptionMode.ON- Optional encryption (TDS 7.x, equivalent to ssl=true)EncryptionMode.STRICT- Mandatory TDS 8.0 encryption (required for SQL Server 2022+ with Force Strict Encryption)
- Parameters:
encryptionMode- the encryption mode- Returns:
- a reference to this, so the API can be used fluently
-
setReconnectAttempts
Description copied from class:SqlConnectOptionsSet the value of reconnect attempts- Overrides:
setReconnectAttemptsin classSqlConnectOptions- Parameters:
attempts- the maximum number of reconnect attempts- Returns:
- a reference to this, so the API can be used fluently
-
setReconnectInterval
Description copied from class:SqlConnectOptionsSet the reconnect interval- Overrides:
setReconnectIntervalin classSqlConnectOptions- Parameters:
interval- the reconnect interval in ms- Returns:
- a reference to this, so the API can be used fluently
-
setCachePreparedStatements
Description copied from class:SqlConnectOptionsSet whether prepared statements cache should be enabled.- Overrides:
setCachePreparedStatementsin classSqlConnectOptions- Parameters:
cachePreparedStatements- true if cache should be enabled- Returns:
- a reference to this, so the API can be used fluently
-
setPreparedStatementCacheMaxSize
Description copied from class:SqlConnectOptionsSet the maximum number of prepared statements that the connection will cache.- Overrides:
setPreparedStatementCacheMaxSizein classSqlConnectOptions- Parameters:
preparedStatementCacheMaxSize- the size to set- Returns:
- a reference to this, so the API can be used fluently
-
setPreparedStatementCacheSqlFilter
Description copied from class:SqlConnectOptionsSet a predicate filtering prepared statements that the connection will cache.The default predicate accepts predicate having query length invalid input: '<'
SqlConnectOptions.DEFAULT_PREPARED_STATEMENT_CACHE_SQL_LIMIT- Overrides:
setPreparedStatementCacheSqlFilterin classSqlConnectOptions- Parameters:
predicate- the filter
-
setPreparedStatementCacheSqlLimit
Description copied from class:SqlConnectOptionsSet the maximum length of prepared statement SQL string that the connection will cache.This is an helper setting the
SqlConnectOptions.setPreparedStatementCacheSqlFilter(Predicate).- Overrides:
setPreparedStatementCacheSqlLimitin classSqlConnectOptions- Parameters:
preparedStatementCacheSqlLimit- the maximum length limit of SQL string to set- Returns:
- a reference to this, so the API can be used fluently
-
setSslOptions
- Overrides:
setSslOptionsin classSqlConnectOptions
-
init
protected void init()Initialize with the default options.- Overrides:
initin classSqlConnectOptions
-
toJson
- Overrides:
toJsonin classSqlConnectOptions
-
merge
Description copied from class:SqlConnectOptionsReturns new options created after this object and merged with theotherjson config.- Overrides:
mergein classSqlConnectOptions- Parameters:
other- the other JSON object- Returns:
- new options created after this object and merged with the
otherjson config
-