Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added a fix that closes a connection with a transaction that was failed to resume by server (#606) #607

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion mssql.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,20 @@ func (c *Conn) checkBadConn(err error) error {
panic("driver.ErrBadConn in checkBadConn. This should not happen.")
}

switch err.(type) {
switch typedErr := err.(type) {
case net.Error:
c.connectionGood = false
return err
case StreamError:
c.connectionGood = false
return err
case Error:
// The server failed to resume the transaction
// Issue https://github.com/denisenkom/go-mssqldb/issues/606
if typedErr.Number == 3971 && typedErr.Class == 16 {
c.connectionGood = false
}
return err
default:
return err
}
Expand Down