ResultSet调用close()报NullPointerException
原因:Resultset 没有实例化就调用close
(eg: ResultSet rs = null;rs.close();)
故断开与数据库相关操作前,先用if判断是否为空
if(rs!=null){
writeLog("关闭ResultSet", filename);
rs.close();
}
if(stmt!=null){
writeLog("关闭Statement", filename);
stmt.close();
}
if(conn!=null){
writeLog("断开Connection", filename);
conn.close();
}