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
database/sql: Ping after statement reports good connection when it has failed #7619
Comments
Comment 2 by marko@joh.to: This appears to have been fixed in Go 1.3 via 3662d56e2402. But it's not clear what you're trying to achieve by calling Ping() after the query in the first place. As far as I can tell, what nil error from Ping() means is that "there is at least one connection to the database which we don't yet know to be bad, or a new connection was successfully established". I don't see where this information would be valuable except perhaps right after sql.Open(). |
Now I'm truly confused. If, as you claim, you can "Exec as much as you want", how does your workaround which still uses Exec help at all? It's not obvious from your description whether you looked at the error from stmt.Exec(), but I get driver.ErrBadConn which should indicate that something's not quite right with the connectivity to the database.
shrug Since Ping() is fine with returning a connection from the pool without actually hitting the server, I don't consider it to be the right tool in the first place. E.g. this program:
consistently prints:
which is quite bogus. |
Was this resolved in 4b90b7a ? |
by zulthank:
The text was updated successfully, but these errors were encountered: