database/sql with mymysql got "expected EOF" sometimes

2,151 views
Skip to first unread message

James Chow

unread,
Mar 7, 2012, 6:20:12 AM3/7/12
to golang-nuts
Hi all,

I am using database/sql with github.com/ziutek/mymysql.
Sometimes, db.Exec gets several "expected EOF" errors, then go on well, then

I am not familiar with database problem.
I guessed it was caused by problem of connection ,
so I try to fix this problem by "wait-retry" way.
It works, but the code is rather "dirty".

Anyone has a better idea?

ziutek

unread,
Mar 7, 2012, 12:53:15 PM3/7/12
to golang-nuts
Do you mean "expected EOF" or "Unexpected EOF"?

There is no "expected EOF" string in mymysql source nor in database/
sql.

If it is "Unexpected EOF" it can be returned from MySQL server (#1039
ER_UNEXPECTED_EOF) or from mymysql (io.ErrUnexpectedEOF).

Brad Fitzpatrick

unread,
Mar 9, 2012, 2:24:51 PM3/9/12
to ziutek, golang-nuts
If this is due to MySQL closing the connection on you, check out the new ErrBadConn for drivers:


(search for "ErrBadConn")

James Chow

unread,
Mar 9, 2012, 9:18:01 PM3/9/12
to golang-nuts
Yes, it is caused by MySQL closing the connection.
The network between program and MySQL is not well,
and rather long in distance. And the reconnecting is needed.
Reply all
Reply to author
Forward
0 new messages