Class MySQLConnectOptions

java.lang.Object
io.vertx.sqlclient.SqlConnectOptions
io.vertx.mysqlclient.MySQLConnectOptions

public class MySQLConnectOptions extends SqlConnectOptions
Connect options for configuring MySQLConnection or MySQLBuilder.
  • Field Details

  • Constructor Details

    • MySQLConnectOptions

      public MySQLConnectOptions()
    • MySQLConnectOptions

      public MySQLConnectOptions(JsonObject json)
    • MySQLConnectOptions

      public MySQLConnectOptions(SqlConnectOptions other)
    • MySQLConnectOptions

      public MySQLConnectOptions(MySQLConnectOptions other)
  • Method Details

    • wrap

      public static MySQLConnectOptions wrap(SqlConnectOptions options)
      Returns:
      the options as MySQL specific connect options
    • fromUri

      public static MySQLConnectOptions fromUri(String connectionUri) throws IllegalArgumentException
      Provide a MySQLConnectOptions configured from a connection URI.
      Parameters:
      connectionUri - the connection URI to configure from
      Returns:
      a MySQLConnectOptions parsed from the connection URI
      Throws:
      IllegalArgumentException - when the connectionUri is 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 to true an 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 the SslMode for 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 default authentication plguin for 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)
      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 MySQLConnectOptions 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 MySQLConnectOptions 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 MySQLConnectOptions 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 MySQLConnectOptions 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
    • setCachePreparedStatements

      public MySQLConnectOptions 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 MySQLConnectOptions 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 MySQLConnectOptions 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 invalid input: '<' SqlConnectOptions.DEFAULT_PREPARED_STATEMENT_CACHE_SQL_LIMIT

      Overrides:
      setPreparedStatementCacheSqlFilter in class SqlConnectOptions
      Parameters:
      predicate - the filter
    • setPreparedStatementCacheSqlLimit

      public MySQLConnectOptions 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
    • setProperties

      public MySQLConnectOptions 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 MySQLConnectOptions 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
    • setReconnectAttempts

      public MySQLConnectOptions 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 MySQLConnectOptions 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
    • setTracingPolicy

      public MySQLConnectOptions setTracingPolicy(TracingPolicy tracingPolicy)
      Description copied from class: SqlConnectOptions
      Set the tracing policy for the client behavior when Vert.x has tracing enabled.
      Overrides:
      setTracingPolicy in class SqlConnectOptions
      Parameters:
      tracingPolicy - the tracing policy
      Returns:
      a reference to this, so the API can be used fluently
    • setSslOptions

      public MySQLConnectOptions 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
    • getSocketAddress

      public SocketAddress getSocketAddress()
      Overrides:
      getSocketAddress in class SqlConnectOptions
    • isUsingDomainSocket

      public boolean isUsingDomainSocket()
      Overrides:
      isUsingDomainSocket in class SqlConnectOptions
    • merge

      public MySQLConnectOptions 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