Hi @Santhi Dhanuskodi , Welcome to Microsoft Q&A,
What happens if the sql connection closed when application is trying to commit or rollback. Will it cause any issues in application and sql server?
In the application:
Exception thrown:
The application catches an exception, usually a SqlException. This will indicate why an attempt to perform an operation failed when the connection was closed.
The specific exception message may vary, but it will usually indicate that the connection was closed or lost.
In SQL Server:
Transaction rollback:
If a transaction has not been committed or rolled back when the connection is closed, SQL Server automatically rolls back the transaction. This ensures that there are no partially committed transactions that cause inconsistent data.
SQL Server has mechanisms to ensure that if the connection is unexpectedly closed, all incomplete transactions are rolled back to maintain database consistency and integrity.
Best Regards,
Jiale
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.