Java Code Examples for io.debezium.jdbc.JdbcConnection

Following code examples demonstrate how to use io.debezium.jdbc.JdbcConnection from debezium. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use io.debezium.jdbc.JdbcConnection and various code implementation of this class.
Example 1
Project : debezium Source File : View Source Code on GitHub

    public Config validate(Map<String, String> connectorConfigs) {
        Configuration config = Configuration.from(connectorConfigs);

        Map<String, ConfigValue> results = config.validate(MySqlConnectorConfig.EXPOSED_FIELDS);

        ConfigValue hostnameValue = results.get(;
        ConfigValue portValue = results.get(;
        ConfigValue userValue = results.get(;
        ConfigValue passwordValue = results.get(;

        if (passwordValue.value() == null || ((String)passwordValue.value()).isEmpty()) {
            logger.warn("The connection password is empty");

        if (hostnameValue.errorMessages().isEmpty()
                && portValue.errorMessages().isEmpty()
                && userValue.errorMessages().isEmpty()) {
            try (MySqlJdbcContext jdbcContext = new MySqlJdbcContext(config)) {
                JdbcConnection mysql = jdbcContext.jdbc();
                try {
                    mysql.execute("SELECT version()");
          "Successfully tested connection for {} with user '{}'", jdbcContext.connectionString(), mysql.username());
                } catch (SQLException e) {
          "Failed testing connection for {} with user '{}'", jdbcContext.connectionString(), mysql.username());
                    hostnameValue.addErrorMessage("Unable to connect: " + e.getMessage());
                } finally {
        return new Config(new ArrayList<>(results.values()));
Example 2
Project : debezium Source File : View Source Code on GitHub

    public OracleStreamingChangeEventSource(OracleConnectorConfig connectorConfig, OracleOffsetContext offsetContext, JdbcConnection jdbcConnection, EventDispatcher<TableId> dispatcher, ErrorHandler errorHandler, Clock clock, OracleDatabaseSchema schema) {
        this.jdbcConnection = jdbcConnection;
        this.dispatcher = dispatcher;
        this.errorHandler = errorHandler;
        this.clock = clock;
        this.schema = schema;
        this.offsetContext = offsetContext;
        this.xStreamServerName = connectorConfig.getXoutServerName();
        this.tablenameCaseInsensitive = connectorConfig.getTablenameCaseInsensitive();
        this.posVersion = connectorConfig.getOracleVersion().getPosVersion();