MySQL reconnect?
#1

Hello guys, is possible to make automatic reconnect to MySQL database if it lose connection for some reason? Or what will happen if server lost connection to MySQL for example when player is registering?
Reply
#2

In the latest versions of MySQL, there is a parameter (autoreconnect) that is set to true by default so it will reconnect.
Reply
#3

I am using R36-2 latest Blue G plugin, hope it have autoreconnect
Reply
#4

It does. You can always open a_mysql.inc and search for mysql_connect function so you can see the parameters:
pawn Код:
native mysql_connect(const host[], const user[], const database[], const password[], port = 3306, bool:autoreconnect = true, pool_size = 2);
Reply
#5

And how it knows / when it check if it lost connection to mysql?
Reply
#6

That is internal, the scripter need not worry about it. You can always use
pawn Код:
mysql_debug( true )
and it will put all this into a mysql_log.txt file. (empty connection - reconnecting, and stuff)
Reply
#7

Or just make a timer that reloads/refreshes the connection every 5/10 minutes, depending on your plugin.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)