Bug #44300 [Com]: mssql_connect fails sometimes

From: Date: Sat, 17 Jul 2010 16:59:08 +0000
Subject: Bug #44300 [Com]: mssql_connect fails sometimes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-152492@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=44300&edit=1

 ID:               44300
 Comment by:       opc dot three at gmail dot com
 Reported by:      alfa77 at gmail dot com
 Summary:          mssql_connect fails sometimes
 Status:           Open
 Type:             Bug
 Package:          MSSQL related
 Operating System: Windows 2000
 PHP Version:      5.2.5

 New Comment:

Related to Bug #35217.


Previous Comments:
------------------------------------------------------------------------
[2010-02-25 10:18:16] healerx78 at yahoo dot com

trials

------------------------------------------------------------------------
[2010-01-19 08:41:40] t dot zander at tuneup dot de

We're experiencing the same problem with Microsofts SQLSRV driver.
So it might be it's not just a driver problem.

------------------------------------------------------------------------
[2009-12-03 17:37:29] dbuerer at leviton dot com

I too have suffered this same problem for the last couple of years on
all of the 5.x release of PHP.  It works great for days then has problem
for a few days then works great.  1-3 page reloads often solves the
problem but not always. Unfortunatley support for this extension has
been discontinued--I wonder if this is one of the reasons why?  I would
like to try using Microsofts SQLSRV driver but converting an entire
website from mssql to sqlsrv is going to be a lot of work!

------------------------------------------------------------------------
[2009-02-13 19:26:45] b116d at mail dot ru

Same problem here.
Apache 2.2.10
Php 5.2.5 as module.
OS win2003 sp1+all critical updates

I even try upgrade to php 5.2.8, but it still appears.

------------------------------------------------------------------------
[2008-12-09 15:25:50] frosty dot z at freesbee dot fr

Hi, same problem detected here (connection "rarely" successful with
mssql_connect, with a MSSQL server under quite heavy load).

Happens only with PHP on Windows, not on Linux (FreeDTS).

But for some reason I needed to connect from PHP/Windows, so I have used
the "ADO workaround", as previously suggested by alfa77.

At first, I didn't understand very well that workaround, so here are
some details :

Do not use the ADOdb engine 'mssql' because it will still use
mssql_connect(). Instead, use 'ado_mssql' which uses COM objects ; that
makes all the difference.

Here is a basic database functions lib :

function db_open($db_host, $db_login, $db_pass, $db_name)
{
  $db = NewADOConnection('ado_mssql');
		
  $dsn="PROVIDER=MSDASQL;DRIVER={SQL Server};"
  .
"SERVER=".$db_host.";DATABASE=".$db_name.";UID=".$db_login.";PWD=".$db_pass.";";
		
  $db->Connect($dsn);
		
  return $db;
}

function db_query($db, $query)
{
  return $db->Execute($query);
}
   
function db_fetch_assoc($res)
{
  $obj = $res->FetchNextObj();
  return get_object_vars($obj);
}
   
function db_close($db)
{
  $db->Close();
}

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    http://bugs.php.net/bug.php?id=44300


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


Thread (15 messages)

« previous php.bugs (#152492) next »