I am getting the unexpected EOF and busy buffer
error in go-sql-driver/mysql
despite after setting the SetConnMaxLifetime
, SetMaxIdleConns
and SetMaxOpenConns
as suggested here. Can anyone tell me the proper solution of this issue nothing seems to work for me?
db, err := sql.Open("mysql", "USERNAME:PASSWORD@tcp(IP:PORT)/DB?charset=utf8")
checkErr(err)
db.SetConnMaxLifetime(time.Second * 5)
db.SetMaxIdleConns(0)
db.SetMaxOpenConns(151)
rows, err := db.Query("Select col1, col2, col3 from tbl")
checkErr(err)
for rows.Next() {
var col1 string
var col2 int32
var col3 uint64
err = rows.Scan(&col1, &col2, &col3)
checkErr(err)
Process(col1, col2, col3)
}