java.sql.SQLException: Parameter index out of range (3 > number of parameters, which is 2)
- by sam
@WebMethod(operationName = "SearchOR")
public SearchOR getSearchOR (@WebParam(name = "comp")
String comp, @WebParam(name = "name")
String name) {
//TODO write your implementation code here:
SearchOR ack = null;
try{
String simpleProc = "{ call getuser_info_or(?,?)}";
CallableStatement cs = con.prepareCall(simpleProc);
cs.setString(1, comp);
cs.setString(2, name);
ResultSet rs = cs.executeQuery();
System.out.print("2");
/* int i = 0,
j = 0;
if (rs.last()) {
i = rs.getRow();
ack = new SearchOR[i];
rs.beforeFirst();
}*/
while (rs.next()) {
// ack[j] = new SearchOR(rs.getString(1), rs.getString(2));
// j++;
ve.add(rs.getString(1));
ve.add(rs.getString(2));
}}catch ( Exception e) {
e.printStackTrace();
System.out.print(e);
}
return ack;
}
I am getting error at portion i have made bold.It is pointing to that location.My Query is
here:
DELIMITER $$
DROP PROCEDURE IF EXISTS discoverdb.getuser_info_or$$
MySQL returned an empty result set (i.e. zero rows).
CREATE PROCEDURE discoverdb.getuser_info_or
(
IN comp VARCHAR(100),
IN name VARCHAR(100),
OUT Login VARCHAR(100),
OUT email VARCHAR(100)
)
BEGIN
SELECT sLogin, sEmail
INTO Login, email
FROM ad_user
WHERE company = comp OR sName=name;
END $$
MySQL returned an empty result set (i.e. zero rows).
DELIMITER ;