Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "JDBC Sources: Wrap SQLTransientException with ConfigErrorExce… #20031

Merged
merged 2 commits into from
Dec 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -15,7 +14,6 @@
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;
Expand Down Expand Up @@ -78,12 +76,8 @@ public <T> Stream<T> unsafeResultSetQuery(final CheckedFunction<Connection, Resu
@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)) {
Expand All @@ -93,7 +87,6 @@ public DatabaseMetaData getMetaData() throws SQLException {
throw new ConnectionErrorException(e.getSQLState(), cause.getErrorCode(), cause.getMessage(), e);
}
}
throw new RuntimeException("Failed to get metadata fron Datasource");
}

/**
Expand Down