I'm connecting to SQL Server (2005) through Java using the Microsoft SQL Server JDBC Driver 2.0.
How do I get the return value from a stored procedure? I'm doing something like:
Connection connection = dataSource.getConnection()
CallableStatement proc = connection.prepareCall("{ call dbo.mySproc() }");
proc.execute();
Should I be using execute()? executeQuery()? executeUpdate()? None of these seem to return a return value by default but I'm not really sure how to get to it.
EDIT 1: To be clear, I know how to call stored procedures. This question is specifically about how to get the RETURN VALUE (as opposed to a Result Set). The Return Value is an integer that is usually generated when you execute a query with no Result Set or if you specificalyl state something like RETURN 0
in your SQL.
EDIT 2: executeUpdate() returns an int but will not return the Return Value.