Values are not returning from MY SQL database to my java class
- by sam
Hi,
This is my Query
DELIMITER $$
DROP PROCEDURE IF EXISTSdiscoverdb.getuser_info$$
# MySQL returned an empty result set (i.e. zero rows).
`CREATE PROCEDURE discoverdb.getuser_info
(
IN name VARCHAR(100),
IN pass VARCHAR(100)
)
BEGIN
SELECT * FROM ad_user WHERE sLogin = name AND sPassHash=password(pass);
END $$
# MySQL returned an empty result set (i.e. zero rows).
DELIMITER ;
This is my calling method
public Authentication getAuthentication (String username,String password) {
//TODO write your implementation code here:
Authentication ack = new Authentication();
try{
String simpleProc = "{ call getuser_infosam(?,?)}";
java.sql.CallableStatement cs = con.prepareCall(simpleProc);
cs.setString(1, username);
cs.setString(2, password);
java.sql.ResultSet rs = cs.executeQuery();
while (rs.next()) {
System.out.println(rs.getString("sLogin"));
System.out.println(rs.getString("sPassHash"));
System.out.println(rs.getString("sForename"));
System.out.println(rs.getString("sName"));
System.out.println(rs.getString("company"));
System.out.println(rs.getString("sEmail"));
rs.close();}
}catch ( Exception e) {
e.printStackTrace();
System.out.print(e);
}
return ack;
}