Database reconnect

Hello,

how can I tell, if the DB connection is alive and reconnect if not? (I'm making the daemon app which should run forever but MySQL drop connections after timeout).

Thanks.



5.1k

Hi,

I'm new to phalconphp, but you could call connect() on the database adapter in your controller/main loop to make sure the connection "it's alive" . PDO should reuse present connections, so no new connections should be created. Otherwise write an own solution utilizing mysqli_ping .