php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39929 Persistent connections and ODBC
Submitted: 2006-12-22 01:16 UTC Modified: 2009-05-03 01:00 UTC
Votes:47
Avg. Score:3.5 ± 1.6
Reproduced:33 of 34 (97.1%)
Same Version:8 (24.2%)
Same OS:13 (39.4%)
From: aloucks at cofront dot net Assigned: wez (profile)
Status: No Feedback Package: PDO related
PHP Version: 5.2.0 OS: Linux 2.4.31
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-12-22 01:16 UTC] aloucks at cofront dot net
Description:
------------
A warning is generated (SQLSTATE[IM001]: Driver does not support this function: driver does not support setting attributes) when retrieving connections with the PDO::ATTR_PERSISTENT set to true.

A valid and usable PDO object is returned. After 5 calls to PDO::__contruct() with the same parameters the warning goes away and the time to create the PDO object drops from 0.08ms to 0.0004ms.

The warning will eventually come back and the connection time will go back up to 0.08ms for a few attempts and then resume back to 0.0004ms.

After a fresh apache restart the first 5 connection attempts  will always generate this warning. (I assume the pool/cache size is 5)

It seems like the connection caching is actually working but a warning is generated when the connection is first established and then again after it eventually times out and a new connection is created.

I'm using unixODBC w/ibm iSeriesAccess odbc drivers.

This bug seems similar to bug: 39845 (http://bugs.php.net/bug.php?id=39845) but I didn't find any code changes related to it outside the pdo_pgsql dir.


Also, I'm not sure if this is related, but PDO::ERRMODE_EXCEPTION, and PDO::ATTR_TIMEOUT also cause warnings to be displayed. I havn't tested any other flags.

Connections failures (tested using bad a username) throw exceptions, but sql queries (tested with bad syntax) did not.




Reproduce code:
---------------
<?php
$dbh = new PDO('odbc:dsn', 'user', 'pass', array(PDO::ATTR_PERSISTENT => true));
?>

Expected result:
----------------
The code works but a warning is generated.



Actual result:
--------------
PHP Warning:  PDO::__construct() [<a href='function.PDO---construct'>function.PDO---construct</a>]: SQLSTATE[IM001]: Driver does not support this function: driver does not support setting attributes in ...

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-22 04:21 UTC] aloucks at cofront dot net
I meant seconds...

0.08ms   -> 0.08s
0.0004ms -> 0.0004s
 [2007-01-17 15:10 UTC] mail at veikkomakinen dot com
The same happens with Postgresql (PHP 5.2.0/Win32, Postgres 8.1.5) Symptoms are identical so it's not just ODBC issue.
 [2007-06-05 10:32 UTC] simon dot schmitt at med dot uni-heidelberg dot de
I have the same problems with PHP 5.2.4, Apache, WinXP, MSSQL-Server 2005
 [2007-07-13 16:24 UTC] paulius at yahoo dot com
I am experiencing the same issue.

Submitted a bug report here:

http://pecl.php.net/bugs/bug.php?id=11603
 [2007-12-14 19:28 UTC] mfaust at usinternet dot com
I get the same error running PHP 5.2.4, Windows XP SP2, SQL Express 2005, and IIS 5.1. I normally don't use the persistent connection option but it temporarily fixes another issue that I have .Not sure if it's related but occasionally I get an error message in the event viewer stating 

Out of process application '/LM/W3SVC/1/Root/ticket' terminated unexpectedly. 
For additional information specific to this message please visit the Microsoft Online Support site located at: http://www.microsoft.com/contentredirect.asp.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.



I create a new connection using 

$this->db_conn = new PDO('mssql:' . $this->conn_str, $this->username, $this->password); 

but after sometime I get the error above and then my connect statement above no longer takes milliseconds but now takes about 2-3 seconds and get:

Event Type:	Information
Event Source:	MSSQL$SQLEXPRESS
Event Category:	(2)
Event ID:	17137
Date:		12/14/2007
Time:		1:01:11 PM
User:		N/A
Computer:	my_pcname
Description:
Starting up database 'my_dbname'.

in the event viewer every time I create a new PDO connection. The only way to solve this is to run the above connect statement but add the array(PDO::ATTR_PERSISTENT => true) parameter. It will give me a warning but the next time I run the connect statement without the persistent option it only takes a few milliseconds to create the connection and no events are logged in the event viewer.

The errors seem to happen after about 15 minutes or so after the last db connection was closed.
 [2008-07-21 18:16 UTC] aloucks at cofront dot net
It's been over a year and a half.. Is this bug going to be addressed?
 [2009-04-25 14:41 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

..and update the version field if bug still exists, otherwise close it.
 [2009-05-03 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-12-14 18:50 UTC] kabot at go2 dot pl
Bug still exists, linux 2.6.18, php 5.2.11
Bigger problem is with PDO::ERRMODE_EXCEPTION becouse with this connection could not be open (with other ERRMODE warning is produced but connection is ok).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 00:01:41 2024 UTC