ID:               47580
 User updated by:  maxcamo at gmail dot com
 Reported By:      maxcamo at gmail dot com
-Status:           Closed
+Status:           Open
 Bug Type:         MSSQL related
 Operating System: Win2003
 PHP Version:      5.2CVS-2009-03-05 (snap)
 New Comment:

ok but i can't connect to the db,

chaging the script like this
if ($connDb)
    mssql_select_db($db, $connDb);
else
    $lastmsg=mssql_get_last_message()

and...

fputs($fp, gmdate("M d Y H:i:s") . ":: Try:$tries :: 
".$ServerName."::
".$lastmsg." :: ". $pageName . "\r\n");

i dont' get any mssql errors, but i get the same problem

I see this error randomly, or on heavy load, i think


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

[2009-03-09 07:32:52] maxcamo at gmail dot com

ok but i can't connect to the db,

chaging the script like this
if ($connDb)
    mssql_select_db($db, $connDb);
else
    $lastmsg=mssql_get_last_message()

and...

fputs($fp, gmdate("M d Y H:i:s") . ":: Try:$tries :: 
".$ServerName."::
".$lastmsg." :: ". $pageName . "\r\n");

i dont' get any mssql errors, but i get the same problem

I see this error randomly, or on heavy load, i think

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

[2009-03-08 14:30:50] ka...@php.net

This is an informal notice from dblib, Microsoft's TechNet have
information about this here:
http://technet.microsoft.com/en-us/library/aa275768(SQL.80).aspx

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

[2009-03-05 21:27:58] maxcamo at gmail dot com

Description:
------------
Hi,

with MSSQL 2005,Apache 2.2.11 and PHP 5.2.6 i get this error when i 
try to connect to the db

Changed database context to

The error raise up when I try to connect to the DB.

connections timeout are high

mssql.connect_timeout = 300
mssql.timeout = 300

It happen randomly, but more frequently when the site traffic si very 
high

Reproduce code:
---------------
$Maxtries=60;

$delayMin=50000;
$delayMax=100000;
$delay=rand($delayMin,$delayMax);
$log_filename="conn_failed.log";
$tries=1;

        $connDb = @mssql_connect($host, $user, $pwd));
        if ($connDb)
                mssql_select_db($db, $connDb);

while(!$connDb){
        
        if ($tries>=$Maxtries){
                //echo "Database failed to respond.";
                $fp = fopen($log_filename,"a+");
                fputs($fp, gmdate("M d Y H:i:s") . ": Errore Connessione \r\n");
                fclose($fp);
                exit;
        }
        
        usleep($delay*$tries);
        $connDb = @mssql_connect($host, $user, $pwd));
        if ($connDb)
                mssql_select_db($db, $connDb);
        
        $tries++;
}

if ($tries>1){
                $fp = fopen($log_filename,"a+");
                fputs($fp, gmdate("M d Y H:i:s") . ":: Try:$tries ::
".$ServerName.":: ".mssql_get_last_message()." :: ". $pageName .
"\r\n");
                fclose($fp);
}



Expected result:
----------------
Db Connection

Actual result:
--------------
Mar 05 2009 21:08:19:: Try:2 :: B-C2N1:: Il contesto di database è 
stato sostituito con 'dbName'. :: /index.html
Mar 05 2009 21:08:20:: Try:8 :: B-C2N1:: Il contesto di database è 
stato sostituito con 'dbName'. :: /page2.html
Mar 05 2009 21:09:26:: Try:6 :: B-C2N1:: Il contesto di database è 
stato sostituito con 'dbName'. :: /page3.html








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


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

Reply via email to