日期:2014-05-16 浏览次数:20442 次
try { rs = stmt.executeQuery(sql); } catch (SQLException e) { System.out.println("execute query in findUserByEmail failed"); e.printStackTrace(); } finally { stmt.close(); conn.close(); } if (rs.next()) { User user = new User(); user.setUserId(rs.getLong(1)); user.setName(rs.getString(2)); user.setEmail(rs.getString(3)); user.setPassword(rs.getString(4)); rs.close(); return user; } else { rs.close(); return null; }
try { rs = stmt.executeQuery(sql); } catch (SQLException e) { System.out.println("execute query in findUserByEmail failed"); e.printStackTrace(); } if (rs.next()) { User user = new User(); user.setUserId(rs.getLong(1)); user.setName(rs.getString(2)); user.setEmail(rs.getString(3)); user.setPassword(rs.getString(4)); rs.close(); stmt.close(); conn.close(); return user; } else { rs.close(); stmt.close(); conn.close(); return null; }