Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

mysql connection timeout #15

Open
davidsd opened this Issue Aug 10, 2012 · 2 comments

Comments

Projects
None yet
2 participants

davidsd commented Aug 10, 2012

Hello,

I'm using Snaplet-HDBC with HDBC-mysql, and currently running into a mysql error 2006 "MySQL server has gone away" when my site goes several hours without being used. What is the preferred way to check if the connection exists and reconnect if necessary?

Thanks,
David

davidsd commented Aug 10, 2012

Ok, it looks like using HdbcSnaplet Connection Pool instead of HdbcSnaplet Connection IO is the solution. The documentation states that for the latter,

A resource pool is created with some default parameters that should be fine for most common usecases. If a custom resource pool configuration is desired, use thehdbcInit'initialiser instead...

However, apparently the code has since changed so that this is no longer the case. Also, the hdbcInit' function no longer exists. I guess the documentation should be updated to reflect this.

There's another issue with this, which is that withResource doesn't bracket snap actions correctly (it'd need to use bracketSnap to do so properly in the presence of pass).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment