java.sql.SQLException: Parameter index out of range (3 > number of parameters, which is 2)

Posted by sam on Stack Overflow See other posts from Stack Overflow or by sam
Published on 2010-06-10T11:19:32Z Indexed on 2010/06/10 11:22 UTC
Read the original article Hit count: 249

Filed under:
|
|

@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 ;

© Stack Overflow or respective owner

Related posts about java

Related posts about mysql