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 configuringMSSQLConnection.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_APP_NAMEstatic StringDEFAULT_CLIENT_INTERFACE_NAMEstatic StringDEFAULT_DATABASEstatic StringDEFAULT_HOSTstatic intDEFAULT_PACKET_SIZEstatic StringDEFAULT_PASSWORDstatic intDEFAULT_PORTstatic Map<String,String>DEFAULT_PROPERTIESstatic booleanDEFAULT_SSLstatic StringDEFAULT_USERstatic intMAX_PACKET_SIZEstatic intMIN_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 MSSQLConnectOptionsaddProperty(String key, String value)Add a property for this client, which will be sent to server at the connection start.static MSSQLConnectOptionsfromUri(String connectionUri)Provide aMSSQLConnectOptionsconfigured from a connection URI.intgetPacketSize()Get the desired size (in bytes) for TDS packets.protected voidinit()Initialize with the default options.booleanisSsl()MSSQLConnectOptionsmerge(JsonObject other)Returns new options created after this object and merged with theotherjson config.MSSQLConnectOptionssetCachePreparedStatements(boolean cachePreparedStatements)Set whether prepared statements cache should be enabled.MSSQLConnectOptionssetDatabase(String database)Specify the default database for the connection.MSSQLConnectOptionssetHost(String host)Specify the host for connecting to the server.MSSQLConnectOptionssetPacketSize(int packetSize)Set the desired size (in bytes) for TDS packets.MSSQLConnectOptionssetPassword(String password)Specify the user password to be used for the authentication.MSSQLConnectOptionssetPort(int port)Specify the port for connecting to the server.MSSQLConnectOptionssetPreparedStatementCacheMaxSize(int preparedStatementCacheMaxSize)Set the maximum number of prepared statements that the connection will cache.MSSQLConnectOptionssetPreparedStatementCacheSqlFilter(Predicate<String> predicate)Set a predicate filtering prepared statements that the connection will cache.MSSQLConnectOptionssetPreparedStatementCacheSqlLimit(int preparedStatementCacheSqlLimit)Set the maximum length of prepared statement SQL string that the connection will cache.MSSQLConnectOptionssetProperties(Map<String,String> properties)Set properties for this client, which will be sent to server at the connection start.MSSQLConnectOptionssetReconnectAttempts(int attempts)Set the value of reconnect attemptsMSSQLConnectOptionssetReconnectInterval(long interval)Set the reconnect intervalMSSQLConnectOptionssetSsl(boolean ssl)Set whether SSL/TLS is enabledMSSQLConnectOptionssetSslOptions(ClientSSLOptions sslOptions)MSSQLConnectOptionssetUser(String user)Specify the user account to be used for the authentication.JsonObjecttoJson()static MSSQLConnectOptionswrap(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
-
-
-
-
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
-
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
optionsas MSSQL specific connect options
-
fromUri
public static MSSQLConnectOptions fromUri(String connectionUri) throws IllegalArgumentException
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
public MSSQLConnectOptions setHost(String host)
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
public MSSQLConnectOptions setPort(int port)
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
public MSSQLConnectOptions setUser(String user)
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
public MSSQLConnectOptions setPassword(String password)
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
public MSSQLConnectOptions setDatabase(String database)
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
public MSSQLConnectOptions setProperties(Map<String,String> properties)
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
public MSSQLConnectOptions addProperty(String key, String value)
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
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- ifpacketSizeis smaller thanMIN_PACKET_SIZEor bigger thanMAX_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: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
public MSSQLConnectOptions setReconnectInterval(long interval)
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
public MSSQLConnectOptions setCachePreparedStatements(boolean cachePreparedStatements)
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
public MSSQLConnectOptions setPreparedStatementCacheMaxSize(int preparedStatementCacheMaxSize)
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
public MSSQLConnectOptions setPreparedStatementCacheSqlFilter(Predicate<String> predicate)
Description copied from class:SqlConnectOptionsSet 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:
setPreparedStatementCacheSqlFilterin classSqlConnectOptions- Parameters:
predicate- the filter
-
setPreparedStatementCacheSqlLimit
public MSSQLConnectOptions setPreparedStatementCacheSqlLimit(int preparedStatementCacheSqlLimit)
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
public MSSQLConnectOptions setSslOptions(ClientSSLOptions sslOptions)
- Overrides:
setSslOptionsin classSqlConnectOptions
-
init
protected void init()
Initialize with the default options.- Overrides:
initin classSqlConnectOptions
-
toJson
public JsonObject toJson()
- Overrides:
toJsonin classSqlConnectOptions
-
merge
public MSSQLConnectOptions merge(JsonObject other)
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
-
-