Hello again list! I'm hacking my way through an email backlog. :-)
On Wed, Mar 02, 2005 at 11:05:03PM -0700, Warren Young wrote:
> >I am using MySQL++ as the API to handle the database stuff for my
> >online RPG. The game has a dedicated server which is left running
> >24/7. Anyway, I notice that if i leave the server running overnight,
> >and no one plays or logs in the whole time, when i try to log in the
> >next day, the server crashes when i try to login (when i do a select
> >statement). It throws a bad_query exception.
> Perhaps the connection has an idle timeout built into it? This is
> almost certainly not in MySQL++, but in the C API below it, or on the
> server side. Take it up on the main MySQL mailing list.
This could easily be a problem. I've left the command line mysql utility
running overnight, and when I try to do a select in it the next day,
I get an error. That program recovers though: if I run the same select
again, it appears to reconnect.
> >Also, if someone can tell me how to extract usefull information from a
> >bad_query exception,
> See the examples.
The original poster might also want to check the connection::errnum()
member inside the catch(BadQuery &bq) handler, and determine whether a
reconnect attempt is in order.
This is assuming that the try/catch is at a level before the connection
goes out of scope and is destroyed, of course. :-)