When a method takes an int specifying which parameter to act upon (the setter, getter, and registerOutParameter methods), that int refers to ? placeholder parameters only, with numbering starting at one. The parameter number does not refer to literal parameters that might be supplied to a stored procedure call. For example, the following code fragment illustrates a stored procedure call with one literal parameter and one ? parameter:
CallableStatement cstmt = con.prepareCall(
"{call getTestData(25, ?)}");
cstmt.registerOutParameter(1, java.sql.Types.TINYINT);
In this code, the first argument to registerOutParameter, the int 1, refers to the first ? parameter (and in this case, the only ? parameter). It does not refer to the literal 25, which is the first parameter to the stored procedure.
Monday, January 19, 2009
8.1.5 Numbering of Parameters
Posted by abhilash at 4:59 AM
Labels: Java, Java DataBase Conectivity.
Subscribe to:
Post Comments (Atom)
0 Comments:
Post a Comment