Skip to content

Commit

Permalink
0006050: Sybase ASE result set has already been closed during trigger
Browse files Browse the repository at this point in the history
exists check
  • Loading branch information
erilong committed Oct 25, 2023
1 parent 1bcef33 commit 5d8f54f
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ public Boolean execute(Connection con) throws SQLException {
ResultSet rs = null;
try {
rs = stmt.executeQuery();
if (rs.next()) {
return rs.getInt(1) > 0;
}
} catch (Exception ex) {
if (catalogName != null) {
log.debug(
Expand All @@ -248,6 +251,9 @@ public Boolean execute(Connection con) throws SQLException {
log.debug("TRY AGAIN Exceute: select count(*) from {}.dbo.sysobjects where type = 'TR' AND name ='{}'", catalogName,
triggerName);
rs = stmt2.executeQuery();
if (rs.next()) {
return rs.getInt(1) > 0;
}
} catch (Exception ex2) {
log.error(String.format(
"Failed again with catalog... select count(*) from %s.dbo.sysobjects where type = 'TR' AND name = '%s'",
Expand All @@ -262,10 +268,6 @@ public Boolean execute(Connection con) throws SQLException {
ex);
}
}
if (rs.next()) {
int count = rs.getInt(1);
return count > 0;
}
} finally {
if (catalogName != null) {
con.setCatalog(previousCatalog);
Expand Down

0 comments on commit 5d8f54f

Please sign in to comment.