public static HashMap<String, String> getUserDetails(String userLogin) {
String methodName = "getUserDetails";
System.out.println(CLASS_NAME + "/" + methodName + "; userLogin = " + userLogin);
LOGGER.debug(CLASS_NAME + "/" + methodName + "; userLogin = " + userLogin);
String userKey = "";
String userStatus = "";
String query = "SELECT * FROM USR WHERE usr_login ='" + userLogin + "' AND usr_status = 'Active'";
HashMap<String, String> hashMap = null;
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet rs = null;
try {
hashMap = new HashMap<String, String>();
connection = Platform.getOperationalDS().getConnection();
preparedStatement = connection.prepareStatement(query);
rs = preparedStatement.executeQuery(query);
while (rs.next()) {
userKey = rs.getString("USR_KEY");
userStatus = rs.getString("USR_STATUS");
hashMap.put("User Key", userKey);
hashMap.put("User Status", userStatus);
}
} catch (SQLException e) {
System.out.println("SQLException : " + e.getMessage());
LOGGER.error("SQLException : " + e.getMessage());
e.printStackTrace();
} finally {
closeDatabaseConnections(connection, preparedStatement, rs);
}
System.out.println("Exiting from the method : " + methodName);
LOGGER.debug("Exiting from the method : " + methodName);
return hashMap;
}
No comments:
Post a Comment