Permalink
Browse files

close statements and result sets properly

  • Loading branch information...
1 parent b3f1e0e commit be021de8cb70f3692bcc7dadf301ff5ea6976f91 @spullara committed Jun 19, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 mysql/src/main/java/avrobase/mysql/MysqlAB.java
@@ -232,6 +232,8 @@ public void writeSchemas(DataOutputStream dos) throws SQLException, IOException
dos.writeBoolean(true);
writeSchemaRow(dos, id, hash, json);
}
+ rs.close();
+ ps.close();
dos.writeBoolean(false);
connection.close();
} finally {
@@ -451,8 +453,8 @@ public int insert() throws AvroBaseException {
throw new AvroBaseException("unexpected response");
}
} finally {
- if (rs2 != null) ps.close();
- if (ps2 != null) ps.close();
+ if (rs2 != null) rs2.close();
+ if (ps2 != null) ps2.close();
if (ps != null) ps.close();
if (c != null) c.close();
}

0 comments on commit be021de

Please sign in to comment.