Open topic with navigation
During a transaction, it is possible for a client application to lose its connection to the database. Connection loss can be caused by failure of any required resource in the client's request path, for example, discontinued network connection, host failure, process termination/failure. Without a connection to the database, the state of the transaction that was in progress is unknown.
Loss of a connection causes an exception to be thrown in the client application the next time the client tries to do something that requires the connection. There are a number of exceptions that a client application must be able to handle. They are all derived from the same basic network exception type, which varies according to the driver you are using.
If the transaction in progress was a read-only transaction then the client application can resubmit the query on a new connection. Because the state of the transaction that was in progress is unknown, the client application does not have the same transaction context. Resubmitting the query on a new connection means restarting the transaction, which means that it is possible that the data being read has changed since the previous transaction was in progress.
If the transaction in progress was an update transaction then what the client application should do depends on the following:
With autocommit behavior enabled (and not suspended by a
START TRANSACTION statement) or if a
COMMIT statement was the last submitted statement then it is up to the client application to determine whether the last transaction was committed and to perform an appropriate action based on that determination.
With autocommit behavior off or suspended and if a
COMMIT statement was not the last submitted statement then the client application should retry the transaction on another connection. As background, if the connection was lost then the transaction engine (TE) eventually notices this and it closes the connection and rolls back the transaction. If the TE has terminated then any changes that were in flight will be rolled back.