close ssh in case of exception during check in Postgres connector (#10620)
* close ssh in case of exception * remove unwanted change * remove comment * format * do not close scanner * fix semi-colon * format
This commit is contained in:
committed by
GitHub
parent
12ddcdf103
commit
f71754d836
@@ -115,18 +115,18 @@ public class CockroachDbSource extends AbstractJdbcSource<JDBCType> {
|
||||
final JsonNode jdbcConfig = toDatabaseConfig(config);
|
||||
|
||||
final JdbcDatabase database = Databases.createJdbcDatabase(
|
||||
jdbcConfig.get("username").asText(),
|
||||
jdbcConfig.has("password") ? jdbcConfig.get("password").asText() : null,
|
||||
jdbcConfig.get("jdbc_url").asText(),
|
||||
driverClass,
|
||||
jdbcConfig.has("connection_properties") ? jdbcConfig.get("connection_properties").asText() : null,
|
||||
sourceOperations);
|
||||
jdbcConfig.get("username").asText(),
|
||||
jdbcConfig.has("password") ? jdbcConfig.get("password").asText() : null,
|
||||
jdbcConfig.get("jdbc_url").asText(),
|
||||
driverClass,
|
||||
jdbcConfig.has("connection_properties") ? jdbcConfig.get("connection_properties").asText() : null,
|
||||
sourceOperations);
|
||||
|
||||
quoteString = (quoteString == null ? database.getMetaData().getIdentifierQuoteString() : quoteString);
|
||||
|
||||
return new CockroachJdbcDatabase(database, sourceOperations);
|
||||
}
|
||||
|
||||
|
||||
private CheckedFunction<Connection, PreparedStatement, SQLException> getPrivileges(JdbcDatabase database) {
|
||||
return connection -> {
|
||||
final PreparedStatement ps = connection.prepareStatement(
|
||||
|
||||
@@ -9,10 +9,6 @@ import io.airbyte.commons.functional.CheckedConsumer;
|
||||
import io.airbyte.commons.functional.CheckedFunction;
|
||||
import io.airbyte.db.JdbcCompatibleSourceOperations;
|
||||
import io.airbyte.db.jdbc.JdbcDatabase;
|
||||
import io.airbyte.db.jdbc.JdbcStreamingQueryConfiguration;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.PreparedStatement;
|
||||
@@ -22,17 +18,15 @@ import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* This implementation uses non-streamed queries to CockroachDB. CockroachDB
|
||||
* does not currently support multiple active pgwire portals on the same session,
|
||||
* which makes it impossible to replicate tables that have over ~1000 rows
|
||||
* using StreamingJdbcDatabase. See: https://go.crdb.dev/issue-v/40195/v21.2
|
||||
* and in particular, the comment:
|
||||
* https://github.com/cockroachdb/cockroach/issues/40195?version=v21.2#issuecomment-870570351
|
||||
* The same situation as kafka-connect applies to StreamingJdbcDatabase
|
||||
* This implementation uses non-streamed queries to CockroachDB. CockroachDB does not currently
|
||||
* support multiple active pgwire portals on the same session, which makes it impossible to
|
||||
* replicate tables that have over ~1000 rows using StreamingJdbcDatabase. See:
|
||||
* https://go.crdb.dev/issue-v/40195/v21.2 and in particular, the comment:
|
||||
* https://github.com/cockroachdb/cockroach/issues/40195?version=v21.2#issuecomment-870570351 The
|
||||
* same situation as kafka-connect applies to StreamingJdbcDatabase
|
||||
*/
|
||||
public class CockroachJdbcDatabase
|
||||
extends JdbcDatabase
|
||||
{
|
||||
extends JdbcDatabase {
|
||||
|
||||
private final JdbcDatabase database;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user