1
DBPreparedStatement stmt = null;
try
{
stmt = new DBPreparedStatement(UTIL.getDatabase(), sql.toString(), "Graph.saveLastGraphName");
stmt.setString(1, DBGlobals.doubleQuote(graphNameUsed));
stmt.setString(2, userUpper);
stmt.executeUpdate();
stmt.close();
}
catch (Exception ex)
{
DBGlobals.Error("OHMjson.Graph.saveLastGraphName - Error: " + ex.getMessage());
msg = "Unable to save data";
status = false;
}
finally
{
if (stmt != null)
stmt.close();
}
我正在關閉finally語句塊中的數據庫語句,這是否正確。 這會造成任何內存泄漏。關閉DB語句
強調從'try'塊中刪除'stmt.close()'語句。否則,它被稱爲兩次! – VoteyDisciple 2010-10-17 19:52:00
調用它兩次是否有錯誤? – John 2010-10-17 20:29:17