Public String getUserLoginByEmail(String email){
Connection connection = null;
PreparedStatement pstatement = null;
ResultSet resultSet = null;
String sql = "select * from usr where usr_mail = ? AND usr_status = 'Active' ";
try {
connection = Platform.getOperationalDS.getConnection();
pstatement = connection.prepareStatement(sql);
prepareStatement.setString(1,email);
resultSet = prepareStatement.executeQuery();
if (resultSet.next()){
String userLogin = resultSet.getString("user_Login");
}
catch(Exception ex){
ex.printStackTrace();
}
finally{
try{
if(connection != null) {
connection.close();
}
if(pStatement != null) {
pStatement.close();
}
if(resultSet != null) {
resultSet.close();
}
}
catch(Exception ex2) {
System.out.println("Exception is : "+ex2.getMessage());
}
return userLogin;
}
No comments:
Post a Comment