- java.lang.Object
-
- io.vertx.sqlclient.SqlConnectOptions
-
- io.vertx.mysqlclient.MySQLConnectOptions
-
public class MySQLConnectOptions extends SqlConnectOptions
Connect options for configuringMySQLConnectionorMySQLBuilder.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_CHARACTER_ENCODINGstatic StringDEFAULT_CHARSETstatic Map<String,String>DEFAULT_CONNECTION_ATTRIBUTESstatic StringDEFAULT_HOSTstatic StringDEFAULT_PASSWORDstatic intDEFAULT_PIPELINING_LIMITstatic intDEFAULT_PORTstatic StringDEFAULT_SCHEMAstatic SslModeDEFAULT_SSL_MODEstatic booleanDEFAULT_USE_AFFECTED_ROWSstatic StringDEFAULT_USER-
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 MySQLConnectOptions()MySQLConnectOptions(JsonObject json)MySQLConnectOptions(MySQLConnectOptions other)MySQLConnectOptions(SqlConnectOptions other)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MySQLConnectOptionsaddProperty(String key, String value)static MySQLConnectOptionsfromUri(String connectionUri)Provide aMySQLConnectOptionsconfigured from a connection URI.MySQLAuthenticationPlugingetAuthenticationPlugin()Get the default authentication plugin for connecting the server.StringgetCharacterEncoding()Get the Java charset for encoding string values.StringgetCharset()Get the charset for the connection.StringgetCollation()Get the collation for the connection.intgetPipeliningLimit()Get the pipelining limit count.StringgetServerRsaPublicKeyPath()Get the path of the server RSA public key.BuffergetServerRsaPublicKeyValue()Get the value of the server RSA public key.SocketAddressgetSocketAddress()SslModegetSslMode()Get the value of the configured SSL mode.protected voidinit()Initialize with the default options.booleanisUseAffectedRows()Get how affected rows are calculated on update/delete/insert.booleanisUsingDomainSocket()MySQLConnectOptionsmerge(JsonObject other)MySQLConnectOptionssetAuthenticationPlugin(MySQLAuthenticationPlugin authenticationPlugin)Set the defaultauthentication plguinfor the client, the option will take effect at the connection start.MySQLConnectOptionssetCachePreparedStatements(boolean cachePreparedStatements)MySQLConnectOptionssetCharacterEncoding(String characterEncoding)Set the Java charset for encoding string values, this value is UTF-8 by default.MySQLConnectOptionssetCharset(String charset)Set the charset for the connection.MySQLConnectOptionssetCollation(String collation)Set the collation for the connection.MySQLConnectOptionssetDatabase(String database)MySQLConnectOptionssetHost(String host)MySQLConnectOptionssetPassword(String password)MySQLConnectOptionssetPipeliningLimit(int pipeliningLimit)Set the pipelining limit count.MySQLConnectOptionssetPort(int port)MySQLConnectOptionssetPreparedStatementCacheMaxSize(int preparedStatementCacheMaxSize)MySQLConnectOptionssetPreparedStatementCacheSqlFilter(Predicate<String> predicate)MySQLConnectOptionssetPreparedStatementCacheSqlLimit(int preparedStatementCacheSqlLimit)MySQLConnectOptionssetProperties(Map<String,String> properties)MySQLConnectOptionssetReconnectAttempts(int attempts)MySQLConnectOptionssetReconnectInterval(long interval)MySQLConnectOptionssetServerRsaPublicKeyPath(String serverRsaPublicKeyPath)Set the path of server RSA public key which is mostly used for encrypting password under insecure connections when performing authentication.MySQLConnectOptionssetServerRsaPublicKeyValue(Buffer serverRsaPublicKeyValue)Set the value of server RSA public key which is mostly used for encrypting password under insecure connections when performing authentication.MySQLConnectOptionssetSslMode(SslMode sslMode)Set theSslModefor the client, this option can be used to specify the desired security state of the connection to the server.MySQLConnectOptionssetSslOptions(ClientSSLOptions sslOptions)MySQLConnectOptionssetTracingPolicy(TracingPolicy tracingPolicy)MySQLConnectOptionssetUseAffectedRows(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.MySQLConnectOptionssetUser(String user)JsonObjecttoJson()static MySQLConnectOptionswrap(SqlConnectOptions options)-
Methods inherited from class io.vertx.sqlclient.SqlConnectOptions
getCachePreparedStatements, getDatabase, getHost, getMetricsName, getPassword, getPort, getPreparedStatementCacheMaxSize, getPreparedStatementCacheSqlFilter, getProperties, getReconnectAttempts, getReconnectInterval, getSslOptions, getTracingPolicy, getUser, setMetricsName
-
-
-
-
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_SCHEMA
public static final String DEFAULT_SCHEMA
- See Also:
- Constant Field Values
-
DEFAULT_CHARSET
public static final String DEFAULT_CHARSET
- See Also:
- Constant Field Values
-
DEFAULT_USE_AFFECTED_ROWS
public static final boolean DEFAULT_USE_AFFECTED_ROWS
- See Also:
- Constant Field Values
-
DEFAULT_SSL_MODE
public static final SslMode DEFAULT_SSL_MODE
-
DEFAULT_CHARACTER_ENCODING
public static final String DEFAULT_CHARACTER_ENCODING
- See Also:
- Constant Field Values
-
DEFAULT_PIPELINING_LIMIT
public static final int DEFAULT_PIPELINING_LIMIT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MySQLConnectOptions
public MySQLConnectOptions()
-
MySQLConnectOptions
public MySQLConnectOptions(JsonObject json)
-
MySQLConnectOptions
public MySQLConnectOptions(SqlConnectOptions other)
-
MySQLConnectOptions
public MySQLConnectOptions(MySQLConnectOptions other)
-
-
Method Detail
-
wrap
public static MySQLConnectOptions wrap(SqlConnectOptions options)
- Returns:
- the
optionsas MySQL specific connect options
-
fromUri
public static MySQLConnectOptions fromUri(String connectionUri) throws IllegalArgumentException
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
public String getCollation()
Get the collation for the connection.- Returns:
- the MySQL collation
-
setCollation
public MySQLConnectOptions setCollation(String collation)
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
public String getCharset()
Get the charset for the connection.- Returns:
- the MySQL collation
-
setCharset
public MySQLConnectOptions setCharset(String charset)
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
public String getCharacterEncoding()
Get the Java charset for encoding string values.- Returns:
- the charset name
-
setCharacterEncoding
public MySQLConnectOptions setCharacterEncoding(String characterEncoding)
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
public MySQLConnectOptions 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. 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
public SslMode getSslMode()
Get the value of the configured SSL mode.- Returns:
- the sslmode
-
setSslMode
public MySQLConnectOptions setSslMode(SslMode sslMode)
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
public MySQLAuthenticationPlugin getAuthenticationPlugin()
Get the default authentication plugin for connecting the server.- Returns:
- the authentication plugin
-
setAuthenticationPlugin
public MySQLConnectOptions setAuthenticationPlugin(MySQLAuthenticationPlugin authenticationPlugin)
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
public MySQLConnectOptions setServerRsaPublicKeyPath(String serverRsaPublicKeyPath)
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
public String getServerRsaPublicKeyPath()
Get the path of the server RSA public key.- Returns:
- the public key path
-
setServerRsaPublicKeyValue
public MySQLConnectOptions setServerRsaPublicKeyValue(Buffer serverRsaPublicKeyValue)
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
public Buffer 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
public MySQLConnectOptions setPipeliningLimit(int pipeliningLimit)
Set the pipelining limit count.- Parameters:
pipeliningLimit- the count to configure- Returns:
- a reference to this, so the API can be used fluently
-
setHost
public MySQLConnectOptions setHost(String host)
- Overrides:
setHostin classSqlConnectOptions
-
setPort
public MySQLConnectOptions setPort(int port)
- Overrides:
setPortin classSqlConnectOptions
-
setUser
public MySQLConnectOptions setUser(String user)
- Overrides:
setUserin classSqlConnectOptions
-
setPassword
public MySQLConnectOptions setPassword(String password)
- Overrides:
setPasswordin classSqlConnectOptions
-
setDatabase
public MySQLConnectOptions setDatabase(String database)
- Overrides:
setDatabasein classSqlConnectOptions
-
setCachePreparedStatements
public MySQLConnectOptions setCachePreparedStatements(boolean cachePreparedStatements)
- Overrides:
setCachePreparedStatementsin classSqlConnectOptions
-
setPreparedStatementCacheMaxSize
public MySQLConnectOptions setPreparedStatementCacheMaxSize(int preparedStatementCacheMaxSize)
- Overrides:
setPreparedStatementCacheMaxSizein classSqlConnectOptions
-
setPreparedStatementCacheSqlFilter
public MySQLConnectOptions setPreparedStatementCacheSqlFilter(Predicate<String> predicate)
- Overrides:
setPreparedStatementCacheSqlFilterin classSqlConnectOptions
-
setPreparedStatementCacheSqlLimit
public MySQLConnectOptions setPreparedStatementCacheSqlLimit(int preparedStatementCacheSqlLimit)
- Overrides:
setPreparedStatementCacheSqlLimitin classSqlConnectOptions
-
setProperties
public MySQLConnectOptions setProperties(Map<String,String> properties)
- Overrides:
setPropertiesin classSqlConnectOptions
-
addProperty
public MySQLConnectOptions addProperty(String key, String value)
- Overrides:
addPropertyin classSqlConnectOptions
-
setReconnectAttempts
public MySQLConnectOptions setReconnectAttempts(int attempts)
- Overrides:
setReconnectAttemptsin classSqlConnectOptions
-
setReconnectInterval
public MySQLConnectOptions setReconnectInterval(long interval)
- Overrides:
setReconnectIntervalin classSqlConnectOptions
-
setTracingPolicy
public MySQLConnectOptions setTracingPolicy(TracingPolicy tracingPolicy)
- Overrides:
setTracingPolicyin classSqlConnectOptions
-
setSslOptions
public MySQLConnectOptions 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
-
getSocketAddress
public SocketAddress getSocketAddress()
- Overrides:
getSocketAddressin classSqlConnectOptions
-
isUsingDomainSocket
public boolean isUsingDomainSocket()
- Overrides:
isUsingDomainSocketin classSqlConnectOptions
-
merge
public MySQLConnectOptions merge(JsonObject other)
- Overrides:
mergein classSqlConnectOptions
-
-