PDO::ATTR_TIMEOUT with unixODBC not working the way I expect?
| From: | Rob Crowell | Date: | Fri, 11 Apr 2014 21:34:40 +0000 |
| Subject: | PDO::ATTR_TIMEOUT with unixODBC not working the way I expect? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-48846@lists.php.net to get a copy of this message | ||
I'm connecting to a closed-source database called Vertica via unixODBC and
PDO. Everything is working great but I am having trouble getting
PDO::ATTR_TIMEOUT attribute working when I create a connection via:
$this->conn = new PDO($dsn, $user, $password,
array(PDO::ATTR_DEFAULT_FETCH_MODE =>
PDO::FETCH_ASSOC,
PDO::ATTR_TIMEOUT => 2));
or
$this->conn->setAttribute(PDO::ATTR_TIMEOUT, 2);
I also found this bug from 2008 (https://bugs.php.net/bug.php?id=45287),
which contains a patch for this issue. But browsing the php mirror on
github, I don't see this patch applied:
https://github.com/php/php-src/blob/master/ext/pdo_odbc/odbc_driver.c#L339-L352
Does anyone have any experience or advice with how I could implement a
database connection timeout without this patch? Thanks!
--Rob