开发者

How can have a SQL connection that is sleeping a pending transaction?

开发者 https://www.devze.com 2023-01-27 15:17 出处:网络
I\'m facing some locks at our DB server created by our application. What I don\'t understand is how a process that is Sleeping is having an Open Transaction (that process 71 is the one creating the 开

I'm facing some locks at our DB server created by our application. What I don't understand is how a process that is Sleeping is having an Open Transaction (that process 71 is the one creating the 开发者_如何学CLock).

As far as I know when a process finishes it closes all the opened transactions. Is that rigth?

Thanks in advance mates.

How can have a SQL connection that is sleeping a pending transaction?


As far as I know when a process finishes it closes all the opened transactions. Is that right?

No. If you explicitly open a transaction you must explicitly commit or rollback. Until that time the transaction remains open so it is perfectly possible for a connection to be idle (not currently processing any task) but still have an uncommitted transaction.

Many people expect that an error will automatically roll back a transaction but this is not the case unless you have

set xact_abort on


As far as I know when a process finishes it closes all the opened transactions. Is that rigth?

Yes. But it is not guaranteed and you should not rely on it. You must explicitly close the connection.

0

精彩评论

暂无评论...
验证码 换一张
取 消