My application is using ADODB to connect simultaneously to 2 MySQL DB. Application is downloading large files; it takes a lot of time so “mysql has gone away” error takes place.
I know that MySQL allows to use automatic reconnection which could be enabled using mysql_options(), but I have no clue how to apply this function to ADODB adapter.
$DB = NewADOConnection('mysql');
$DB->Connect(DB_HOST, DB_LOGIN, DB_PASSWORD, DB_DBNAME);
Thank you for you time!
PS: Probably I should ask how to get DB handler variable from $DB? If I could get DB connection handler from ADODO as $handler I could use mysql_options($handler, MYSQL_OPT_RECONNECT, 1); But how could I get $handler if I should call mysql_options() before connection (according to MySQL reference http://dev.mysql.com/doc/refman/5.0/en/mysql-options.html )
To set mysql options, you can use dsn. This is my connection template that I always use:
You can omit the
sqlitedriver conditional block if you will only use this for MySQL.Apparentlt, PHP MySQL client only support limited option, here is the list. You can try MySQLi, it have more options.
Have you try the persistent connection istead?