ID:               39929
 Comment by:       mfaust at usinternet dot com
 Reported By:      aloucks at cofront dot net
 Status:           Assigned
 Bug Type:         PDO related
 Operating System: Linux 2.4.31
 PHP Version:      5.2.0
 Assigned To:      wez
 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[2007-07-13 16:24:29] 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-06-05 10:32:51] 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-01-17 15:10:54] 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.

------------------------------------------------------------------------

[2006-12-22 04:21:05] aloucks at cofront dot net

I meant seconds...

0.08ms   -> 0.08s
0.0004ms -> 0.0004s

------------------------------------------------------------------------

[2006-12-22 01:16:56] 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 ...


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=39929&edit=1

Reply via email to