You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/reader/JdbcSourceSplitReader.java
+9-3Lines changed: 9 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -146,9 +146,15 @@ public RecordsWithSplitIds<RecordAndOffset<T>> fetch() throws IOException {
146
146
// Check if ResultSet is still open before calling next()
147
147
// This is needed for databases like Derby where ResultSet might be closed
148
148
// when autocommit is disabled
149
-
if (!resultSet.isClosed()) {
150
-
hasNextRecordCurrentSplit = resultSet.next();
151
-
} else {
149
+
try {
150
+
if (!resultSet.isClosed()) {
151
+
hasNextRecordCurrentSplit = resultSet.next();
152
+
} else {
153
+
hasNextRecordCurrentSplit = false;
154
+
}
155
+
} catch (SQLExceptione) {
156
+
// Connection might be closed (e.g., PostgreSQL throws exception on
0 commit comments