[Cppcms-users] How to reconnect to MySQL
Brought to you by:
artyom-beilis
From: 陈抒 <csf...@gm...> - 2011-12-05 16:04:15
|
Hello, My web site's DB connection broke because of timeout. My web site is developed in China,but MySQL server is running in the USA. I got one error log: 2011-12-05 15:43:02 GMT; cppcms, error: Caught exception [cppdb::mysql::Lost connection to MySQL server during query] (http_context.cpp:150) I have used reconnect property already: stringstream stream; stream<<"mysql:host="<<config.mysql_ip<<";database="<<config.mysql_db_name<<";user="<<config.mysql_user<<";password="<<config.mysql_password<<";@pool_size=20;set_charset_name=utf8; opt_reconnect=1"; But it didn't work. How should I do? Catch exception and call cppdb::connections_manager::gc() ? 陈抒 Best regards http://blog.csdn.net/sheismylife |