This reverts commit 9736352d20.
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user