Class MySqlJdbcContext

java.lang.Object
io.debezium.connector.mysql.legacy.MySqlJdbcContext
All Implemented Interfaces:
AutoCloseable

public class MySqlJdbcContext extends Object implements AutoCloseable
A context for a JDBC connection to MySQL.
Author:
Randall Hauch
  • Field Details

  • Constructor Details

  • Method Details

    • config

      public Configuration config()
    • jdbc

      public JdbcConnection jdbc()
    • logger

      public org.slf4j.Logger logger()
    • username

      public String username()
    • password

      public String password()
    • hostname

      public String hostname()
    • port

      public int port()
    • sslMode

    • sslModeEnabled

      public boolean sslModeEnabled()
    • sslKeyStore

      public String sslKeyStore()
    • sslKeyStorePassword

      public char[] sslKeyStorePassword()
    • sslTrustStore

      public String sslTrustStore()
    • sslTrustStorePassword

      public char[] sslTrustStorePassword()
    • eventProcessingFailureHandlingMode

      public CommonConnectorConfig.EventProcessingFailureHandlingMode eventProcessingFailureHandlingMode()
    • inconsistentSchemaHandlingMode

      public CommonConnectorConfig.EventProcessingFailureHandlingMode inconsistentSchemaHandlingMode()
    • shutdown

      public void shutdown()
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • isGtidModeEnabled

      public boolean isGtidModeEnabled()
      Determine whether the MySQL server has GTIDs enabled.
      Returns:
      false if the server's gtid_mode is set and is OFF, or true otherwise
    • knownGtidSet

      public String knownGtidSet()
      Determine the executed GTID set for MySQL.
      Returns:
      the string representation of MySQL's GTID sets; never null but an empty string if the server does not use GTIDs
    • subtractGtidSet

      public GtidSet subtractGtidSet(GtidSet set1, GtidSet set2)
      Determine the difference between two sets.
      Returns:
      a subtraction of two GTID sets; never null
    • purgedGtidSet

      public GtidSet purgedGtidSet()
      Get the purged GTID values from MySQL (gtid_purged value)
      Returns:
      A GTID set; may be empty if not using GTIDs or none have been purged yet
    • userHasPrivileges

      public boolean userHasPrivileges(String grantName)
      Determine if the current user has the named privilege. Note that if the user has the "ALL" privilege this method returns true.
      Parameters:
      grantName - the name of the MySQL privilege; may not be null
      Returns:
      true if the user has the named privilege, or false otherwise
    • connectionString

      public String connectionString()
    • readMySqlCharsetSystemVariables

      protected Map<String,String> readMySqlCharsetSystemVariables()
      Read the MySQL charset-related system variables.
      Returns:
      the system variables that are related to server character sets; never null
    • readMySqlSystemVariables

      public Map<String,String> readMySqlSystemVariables()
      Read the MySQL system variables.
      Returns:
      the system variables that are related to server character sets; never null
    • querySystemVariables

      private Map<String,String> querySystemVariables(String statement)
    • readDatabaseCollations

      protected Map<String,MySqlJdbcContext.DatabaseLocales> readDatabaseCollations()
      Read the MySQL default character sets for exisiting databases.
      Returns:
      the map of database names with their default character sets; never null
    • setStatementFor

      protected String setStatementFor(Map<String,String> variables)
    • setSystemProperty

      protected void setSystemProperty(String property, Field field, boolean showValueInError)
    • getSessionVariableForSslVersion

      public String getSessionVariableForSslVersion()
      Read the Ssl Version session variable.
      Returns:
      the session variables that are related to sessions ssl version