Stored Procedure and Timeout

2019-08-26 20:05发布

问题:

I'm running a long process stored procedure.

I'm wondering if in case of a timeout or any case of disconnection with the database after initiating the call to the stored procedure. Is it still working and implementing the changes on the server? ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­

回答1:

Anyway if the client is not there to commit at the end of the job the changes should be rolled back by the server.

In other words, if you have a stored procedure making changes to the database and there is a possibility that the connection might disconnect in the middle, be sure to enclose all changes within a transaction.



回答2:

It depends on the server I guess.
I know Firebird will detect disconnected clients and stop working.
Anyway if the client is not there to commit at the end of the job the changes should be rolled back by the server.



回答3:

I would suggest running your profiler on the database and watching the activity, and also create a basic test case so that you know for sure what happens. The outcome is dependent on your database and what you are using to connect to it.