gstackoverflow gstackoverflow - 9 months ago 52
Java Question

Synchrounous execution of stored procedure

I have the following code:

connection = makeConnection();
CallableStatement callableStatement = connection.prepareCall("{call dbo.delete_orders(?) }");
callableStatement.setString(1, userName);

Please help me to understand how I can guarantee that after last row execution stored procedure execution will be finished or it executes asynchronously.

Answer Source

JDBC does not support asynchronous executions.

But on the other hand JDBC also doesn't specify that calling (some of its methods like execute()) is blocking. That means that you may get (first) results from the database while it is still executing the query in background.

But this depends on the implementation of the JDBC driver and the Database itself.