日期:2014-05-18 浏览次数:20690 次
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try(
String sql="";
sql="select * from XXX";
conn = InitAction.getConnection();
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(sql);
sql="update XXX where id=1";
conn = InitAction.getConnection();
pstmt = conn.prepareStatement(sql);
pstmt.executeUpdate();
)
catch (SQLException ex) {
log.error(ex.getMessage());
} finally {
CloseResource.closeRs(rs);
CloseResource.closeStatement(pstmt);
CloseResource.closeConn(conn);
}