From: mallinger at tc dot edu
Operating system: Windows 2003 Server
PHP version: 5.2.1
PHP Bug Type: MSSQL related
Bug description: Multiple Queries in MSSQL Kills Connection and Prevents New
Connections
Description:
------------
When executing multiple queries from a single mssql_query call, the
connection is lost and subsequent connections cannot be created. There are
similar problems documented for PHP4, but it seems that (a) this is not
documented for PHP5; and (b) the inability to create subsequent connections
is not documented. In particular, it seems the mssql_select_db is what is
failing in the second connection.
Reproduce code:
---------------
$conn = mssql_connect('host', 'user', 'pass');
mssql_select_db("db", $conn);
mssql_query("QUERY 1", $conn);
mssql_query("QUERY 2; QUERY 3; QUERY 4;", $conn);
// this will fail:
mssql_query("QUERY 5", $conn);
// this is ok
mssql_close($conn);
// everything below will fail too:
$conn2 = mssql_connect('host', 'user', 'pass');
mssql_select_db("db", $conn2);
mssql_query("QUERY 6", $conn2);
Expected result:
----------------
The queries should execute with no problems.
Actual result:
--------------
Everything after the multiple query mssql_query call ("QUERY 2; QUERY 3;
QUERY 4;" will fail. New connections fail when trying to select a database
("mssql_select_db() [function.mssql-select-db]: Unable to select
database:...") and the existing connection cannot be used anymore
("mssql_query() [function.mssql-query]: Query failed in...") .
--
Edit bug report at http://bugs.php.net/?id=41244&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=41244&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=41244&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=41244&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41244&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=41244&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41244&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41244&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41244&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41244&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41244&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=41244&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=41244&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41244&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41244&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41244&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41244&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41244&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41244&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41244&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41244&r=mysqlcfg