Class MySQLConnectOptions
java.lang.Object
io.vertx.sqlclient.SqlConnectOptions
io.vertx.mysqlclient.MySQLConnectOptions
Connect options for configuring
MySQLConnection or MySQLBuilder.-
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 MySQLConnectOptionsProvide aMySQLConnectOptionsconfigured from a connection URI.Get the default authentication plugin for connecting the server.Get the Java charset for encoding string values.Get the charset for the connection.Get the collation for the connection.intGet the pipelining limit count.Get the path of the server RSA public key.Get the value of the server RSA public key.Get the value of the configured SSL mode.protected voidinit()Initialize with the default options.booleanGet how affected rows are calculated on update/delete/insert.booleanmerge(JsonObject other) Returns new options created after this object and merged with theotherjson config.setAuthenticationPlugin(MySQLAuthenticationPlugin authenticationPlugin) Set the defaultauthentication plguinfor the client, the option will take effect at the connection start.setCachePreparedStatements(boolean cachePreparedStatements) Set whether prepared statements cache should be enabled.setCharacterEncoding(String characterEncoding) Set the Java charset for encoding string values, this value is UTF-8 by default.setCharset(String charset) Set the charset for the connection.setCollation(String collation) Set the collation for the connection.setDatabase(String database) Specify the default database for the connection.Specify the host for connecting to the server.setPassword(String password) Specify the user password to be used for the authentication.setPipeliningLimit(int pipeliningLimit) Set the pipelining limit count.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 intervalsetServerRsaPublicKeyPath(String serverRsaPublicKeyPath) Set the path of server RSA public key which is mostly used for encrypting password under insecure connections when performing authentication.setServerRsaPublicKeyValue(Buffer serverRsaPublicKeyValue) Set the value of server RSA public key which is mostly used for encrypting password under insecure connections when performing authentication.setSslMode(SslMode sslMode) Set theSslModefor the client, this option can be used to specify the desired security state of the connection to the server.setSslOptions(ClientSSLOptions sslOptions) setTracingPolicy(TracingPolicy tracingPolicy) Set the tracing policy for the client behavior when Vert.x has tracing enabled.setUseAffectedRows(boolean useAffectedRows) Sets how affected rows are calculated on update/delete/insert, if set totruean update that effectively does not change any data returns zero affected rows.Specify the user account to be used for the authentication.toJson()static MySQLConnectOptionswrap(SqlConnectOptions options) Methods inherited from class SqlConnectOptions
getCachePreparedStatements, getDatabase, getHost, getMetricsName, getPassword, getPort, getPreparedStatementCacheMaxSize, getPreparedStatementCacheSqlFilter, getProperties, getReconnectAttempts, getReconnectInterval, getSslOptions, getTracingPolicy, getUser, setMetricsName
-
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_SCHEMA
- See Also:
-
DEFAULT_CHARSET
- See Also:
-
DEFAULT_USE_AFFECTED_ROWS
public static final boolean DEFAULT_USE_AFFECTED_ROWS- See Also:
-
DEFAULT_CONNECTION_ATTRIBUTES
-
DEFAULT_SSL_MODE
-
DEFAULT_CHARACTER_ENCODING
- See Also:
-
DEFAULT_PIPELINING_LIMIT
public static final int DEFAULT_PIPELINING_LIMIT- See Also:
-
-
Constructor Details
-
MySQLConnectOptions
public MySQLConnectOptions() -
MySQLConnectOptions
-
MySQLConnectOptions
-
MySQLConnectOptions
-
-
Method Details
-
wrap
- Returns:
- the
optionsas MySQL specific connect options
-
fromUri
Provide aMySQLConnectOptionsconfigured from a connection URI.- Parameters:
connectionUri- the connection URI to configure from- Returns:
- a
MySQLConnectOptionsparsed from the connection URI - Throws:
IllegalArgumentException- when theconnectionUriis in an invalid format
-
getCollation
-
setCollation
Set the collation for the connection.- Parameters:
collation- the collation to set- Returns:
- a reference to this, so the API can be used fluently
-
getCharset
-
setCharset
Set the charset for the connection.- Parameters:
charset- the charset to set- Returns:
- a reference to this, so the API can be used fluently
-
getCharacterEncoding
Get the Java charset for encoding string values.- Returns:
- the charset name
-
setCharacterEncoding
Set the Java charset for encoding string values, this value is UTF-8 by default.- Parameters:
characterEncoding- the Java charset to configure- Returns:
- a reference to this, so the API can be used fluently
-
isUseAffectedRows
public boolean isUseAffectedRows()Get how affected rows are calculated on update/delete/insert.- Returns:
- how affected rows are calculated on update/delete/insert.
-
setUseAffectedRows
Sets how affected rows are calculated on update/delete/insert, if set totruean update that effectively does not change any data returns zero affected rows. See mysql-affected-rows for details.- Parameters:
useAffectedRows- whether only affected rows are count- Returns:
- a reference to this, so the API can be used fluently
-
getSslMode
-
setSslMode
Set theSslModefor the client, this option can be used to specify the desired security state of the connection to the server.- Parameters:
sslMode- the ssl-mode to specify- Returns:
- a reference to this, so the API can be used fluently
-
getAuthenticationPlugin
Get the default authentication plugin for connecting the server.- Returns:
- the authentication plugin
-
setAuthenticationPlugin
Set the defaultauthentication plguinfor the client, the option will take effect at the connection start.- Parameters:
authenticationPlugin- the auth plugin to use- Returns:
- a reference to this, so the API can be used fluently
-
setServerRsaPublicKeyPath
Set the path of server RSA public key which is mostly used for encrypting password under insecure connections when performing authentication.- Parameters:
serverRsaPublicKeyPath- the path of the server RSA public key- Returns:
- a reference to this, so the API can be used fluently
-
getServerRsaPublicKeyPath
Get the path of the server RSA public key.- Returns:
- the public key path
-
setServerRsaPublicKeyValue
Set the value of server RSA public key which is mostly used for encrypting password under insecure connections when performing authentication.- Parameters:
serverRsaPublicKeyValue- the value of the server RSA public key- Returns:
- a reference to this, so the API can be used fluently
-
getServerRsaPublicKeyValue
Get the value of the server RSA public key.- Returns:
- the public key value
-
getPipeliningLimit
public int getPipeliningLimit()Get the pipelining limit count.- Returns:
- the pipelining count
-
setPipeliningLimit
Set the pipelining limit count.- Parameters:
pipeliningLimit- the count to configure- Returns:
- a reference to this, so the API can be used fluently
-
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
-
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
-
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
-
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
-
setTracingPolicy
Description copied from class:SqlConnectOptionsSet the tracing policy for the client behavior when Vert.x has tracing enabled.- Overrides:
setTracingPolicyin classSqlConnectOptions- Parameters:
tracingPolicy- the tracing policy- 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
-
getSocketAddress
- Overrides:
getSocketAddressin classSqlConnectOptions
-
isUsingDomainSocket
public boolean isUsingDomainSocket()- Overrides:
isUsingDomainSocketin 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
-