Skip to content

Commit

Permalink
Need to close resultset and statement objects used by JDBCDDB.java ju…
Browse files Browse the repository at this point in the history
…st like the connection at the end.
  • Loading branch information
ggalibert committed Nov 6, 2017
1 parent 0ec9dd3 commit 46ed41f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Binary file modified Java/ddb.jar
Binary file not shown.
12 changes: 9 additions & 3 deletions Java/src/org/imos/ddb/JDBCDDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ public ArrayList<Object> executeQuery(
throws Exception {

Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
ArrayList<Object> results = null;

try {
Expand All @@ -126,8 +128,6 @@ public ArrayList<Object> executeQuery(
}

//execute the query
Statement stmt = null;
ResultSet rs = null;
try {
stmt = conn.createStatement();
rs = stmt.executeQuery(query);
Expand Down Expand Up @@ -177,7 +177,13 @@ public ArrayList<Object> executeQuery(
}

//always close db connection
finally {try {conn.close();} catch (Exception e) {}}
finally {
try {
rs.close();
stmt.close();
conn.close();
}
catch (Exception e) {}}

return results;
}
Expand Down

0 comments on commit 46ed41f

Please sign in to comment.