Giter VIP home page Giter VIP logo

Comments (5)

ziutek avatar ziutek commented on August 18, 2024

Did you read #22

from mymysql.

ziutek avatar ziutek commented on August 18, 2024

database/sql manages connection itself (establishes new if it need, reconnect if connection was closed). Pinging idle connection need concurrent access to the connection, so it need to introduce mutexes and other overhead like in mymysql/thrsafe engine (mymysql/thrsafe implements keepalive on idle connection using SQL PING command).

Because of database/sql behavior to manage pool of connections and automatically reconnect if some connection was closed, godrv by default uses mymysql/native engine. If you want keepalives import thrsafe engine with godrv like this:

import (
_ github.com/ziutek/mymysql/thrsafe
_ github.com/ziutek/mymysql/godrv
database/sql
)

from mymysql.

lins05 avatar lins05 commented on August 18, 2024

So even if use the godrv package without the thrsafe, database/sql would handle the "mysql has gone away" problem for me?

from mymysql.

ziutek avatar ziutek commented on August 18, 2024

Did you read database/sql documentation or use it before create this issue?

from mymysql.

julienschmidt avatar julienschmidt commented on August 18, 2024

Please make sure to run Go 1.0.3 or higher. In older versions there was a bug which caused database/sql to not handle closed connections well.
See http://code.google.com/p/go/source/detail?r=b397807815a6 for more details

from mymysql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.