Bob Grossman wrote:Thanks, Koen, your solution worked.
For anyone else reading this, the syntax of the call to the procedure is not obvious. Note the curly braces in the SQL. You use setInt(), setString(), etc. methods to set the values where the question marks go:
Though really not obvious, it is actually documented in the
CallableStatement javadoc.
Just for completeness, the curly braces are "translated" by the
JDBC driver into proper syntax needed to call stored procedures in the database supported by the driver. As the exact syntax differs across databases, this allows to use database-agnostic code when calling stored procedures.
Nothing actually prevents you to use real target database syntax. In your case you'd replace the curly braces and the enclosed text with
begin recalc_1_student_grades_v1(?, ?); end - rest of the code would remain the same. This does not bring you anything actually and just makes the code database dependent, but sometimes you can use this trick to use other database dependent feature that is not directly supported by JDBC, such as the
returning clause in Oracle's DML statements, which can be quite useful in putting a sequence number into a new record and returning it to the application in one go (among other uses).