1
0
mirror of synced 2026-01-06 15:03:36 -05:00

Revert "JDBC Sources: Wrap SQLTransientException with ConfigErrorException (#19711)" (#20031)

This reverts commit 9736352d20.
This commit is contained in:
Akash Kulkarni
2022-12-02 12:38:01 -08:00
committed by GitHub
parent 1e96e54e6e
commit a3343efddb

View File

@@ -5,7 +5,6 @@
package io.airbyte.db.jdbc;
import com.google.errorprone.annotations.MustBeClosed;
import io.airbyte.commons.exceptions.ConfigErrorException;
import io.airbyte.commons.exceptions.ConnectionErrorException;
import io.airbyte.commons.functional.CheckedConsumer;
import io.airbyte.commons.functional.CheckedFunction;
@@ -15,7 +14,6 @@ import java.sql.DatabaseMetaData;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.SQLTransientException;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -78,12 +76,8 @@ public class DefaultJdbcDatabase extends JdbcDatabase {
@Override
public DatabaseMetaData getMetaData() throws SQLException {
try (final Connection connection = dataSource.getConnection()) {
return connection.getMetaData();
} catch (final SQLTransientException e) {
final String message = e.getMessage();
if (message.contains("request timed out")) {
throw new ConfigErrorException("Connection timed out. Unable to contact server. Please check your server settings or try again later", e);
}
final DatabaseMetaData metaData = connection.getMetaData();
return metaData;
} catch (final SQLException e) {
// Some databases like Redshift will have null cause
if (Objects.isNull(e.getCause()) || !(e.getCause() instanceof SQLException)) {
@@ -93,7 +87,6 @@ public class DefaultJdbcDatabase extends JdbcDatabase {
throw new ConnectionErrorException(e.getSQLState(), cause.getErrorCode(), cause.getMessage(), e);
}
}
throw new RuntimeException("Failed to get metadata fron Datasource");
}
/**