dbTalk Databases Forums  

bad_query exception being thrown when leaving program running idle for a while.

mailing.database.mysql-plusplus mailing.database.mysql-plusplus


Discuss bad_query exception being thrown when leaving program running idle for a while. in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Drew Ferraro
 
Posts: n/a

Default bad_query exception being thrown when leaving program running idle for a while. - 03-02-2005 , 03:20 AM






Hi,

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.

Does anyone know why this is happening, and how i can prevent it?
Also, if someone can tell me how to extract usefull information from a
bad_query exception, that would be appreciated. I couldnt find much
info on it in the docs.

Thanks again!

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw


Reply With Quote
  #2  
Old   
Chris Frey
 
Posts: n/a

Default Re: bad_query exception being thrown when leaving program running idle for a while. - 03-04-2005 , 01:07 AM






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:
Quote:
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.

Quote:
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. :-)

- Chris


--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.