Welcome Guest, Not a member yet? Register   Sign In
Set database connection timeout in CodeIgniter 3
#5

Answer is take from the stackoverflow question and it was as easy as this:


Code:
It is not a documented feature, but you can do this from the database config file (application/config/database.php) by adding options setting e.g.:

$db['default']['options'] = array(PDO::ATTR_TIMEOUT => 5);
The other settings which use the same internal mechanism (e.g. PDO::MYSQL_ATTR_INIT_COMMAND set with $db['default']['stricton'] and PDO::MYSQL_ATTR_COMPRESS set with $db['default']['compress']) are not affected by this.

If you want to dig deeper or check which options are set, you can log $this->options in db_connect function in system/database/drivers/pdo/pdo_driver.php and also check database/drivers/pdo/subdrivers/pdo_mysql_driver.php.
Reply


Messages In This Thread
RE: Set database connection timeout in CodeIgniter 3 - by Jordy - 09-21-2015, 08:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB