Values are not returning from MY SQL database to my java class
Posted
by sam
on Stack Overflow
See other posts from Stack Overflow
or by sam
Published on 2010-06-12T05:35:00Z
Indexed on
2010/06/12
5:43 UTC
Read the original article
Hit count: 280
Hi,
This is my Query
DELIMITER $$
DROP PROCEDURE IF EXISTS
discoverdb.
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;
}
© Stack Overflow or respective owner