Skip to content

Commit

Permalink
Auto-close ResultSet
Browse files Browse the repository at this point in the history
  • Loading branch information
turing85 committed Apr 30, 2024
1 parent d24253b commit 1f9e8f5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/de/turing85/run/query/RunQueryResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public class RunQueryResource {
@Transactional
public Response runQuery(@Valid @NotNull @QueryParam("query") String query) {
try (Connection connection = dataSource.getConnection();
Statement statement = connection.createStatement()) {
final ResultSet rs = statement.executeQuery(query);
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery(query)) {
return Response.ok(transformToCsv(rs)).build();
} catch (Exception e) {
final String message = e.getMessage();
Expand Down

0 comments on commit 1f9e8f5

Please sign in to comment.