PDO::ATTR_TIMEOUT with unixODBC not working the way I expect?
Rob Crowell <[email protected]> Fri, 11 Apr 2014 17:34:40 -0400
| Newsgroups | gmane.comp.php.database |
|---|---|
| Message-ID | <CAFFrk1g1bjAyYexMeyhfCdLwroX9Y3DsEkCm-buw18N2yxVTbg@mail.gmail.com> |
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