level 3
掌柜的685
楼主
public ArrayList findAll(String sql) {
Connection con = null;
try {
con = getConnection();
Statement st = con.createStatement();
ResultSet rs=st.executeQuery(sql);
return resultToList(rs);
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
if (con != null) {
try {
con.close();
} catch (SQLException ex) {
Logger.getLogger(DB.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
}
2015年12月16日 07点12分
1
Connection con = null;
try {
con = getConnection();
Statement st = con.createStatement();
ResultSet rs=st.executeQuery(sql);
return resultToList(rs);
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
if (con != null) {
try {
con.close();
} catch (SQLException ex) {
Logger.getLogger(DB.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
}