I'm having issues setting the timeout in go-mssqldb
This is my current connection string:
sqlserver://user:password@server?timeout=1m30s
I can connect just fine, run queries etc. but I keep timing out at the default value of 30 seconds. I'm referencing the documentation here.
What am I missing?
import (
"database/sql"
_ "github.com/denisenkom/go-mssqldb"
)
func main(){
db, err := sql.Open("mssql", "sqlserver://user:password@server?timeout=1m30s")
if err != nil{
panic(err)
}
_, err = db.Exec("run query that takes longer than 30 seconds")
if err != nil{
panic(err)
}
// panic at 30 seconds...
// panic: read tcp {my ip}->{server ip}: i/o timeout
}