Mega Code Archive

 
Categories / Java Tutorial / Database
 

The CallableStatement

The CallableStatement extends the PreparedStatement interface. The CallableStatement provides an interface for calling database stored procedures. the simplest form of this syntax would be: {call procedure-name} which represents a call to a stored procedure with no parameters. A call to a stored procedure accepting two input parameters: {call procedure-name (?, ?)}     CallableStatement callproc = connection.prepareCall("{call updateLast (?, ?)}");     callproc.setInt (1, 5);          // 1 specifies the first parameter     callproc.setString (2, "J");     // 2 specifies the second parameter To now execute the stored procedure, we use the following statement: callproc.executeUpdate();