0

How do I pass extra connection options, like connect_timeout, keepalives, etc.. with DBAL?

Should it be passed as driverOptions or a pull request created for explicit support at Doctrine\DBAL\Driver\PDOPgSql\Driver ?

I tried passing via driverOptions => ['connect_timeout' => 1], but not sure whether these settings are effective. When I do that with plain pdo_connect call:

$connectionString = 'host=... connect_timeout=1 keepalives=1 keepalives_idle=2 keepalives_interval=1 keepalives_count=2'
$connection = pg_connect($connectionString); 

I know that these settings are at least applied because if I misspell any of those extra parameters an exception is raised:

$connectionString = 'host=... connection_timeout=1'
$connection = pg_connect($connectionString); 
PHP Warning:  pg_connect(): Unable to connect to PostgreSQL server: invalid connection option "connection_timeout" in /troubleshoot/psql.php on line 18

And this exception is the way I check that this setting has been applied.

I do not get such error if I misspell configuration passed to DBAL though.

Mykola Gurov
  • 8,517
  • 4
  • 29
  • 27

1 Answers1

0

Apparently this is not supported at the moment. All the extra options should be explicitly added to the PDOPgSql/Driver.php.

Mykola Gurov
  • 8,517
  • 4
  • 29
  • 27