#47580 [Opn->Fbk]: MSSQL: "Changed database context to" when connecting

From: Date: Mon, 25 May 2009 19:46:59 +0000
Subject: #47580 [Opn->Fbk]: MSSQL: "Changed database context to" when connecting
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-137722@lists.php.net to get a copy of this message
ID: 47580 Updated by: kalle@php.net Reported By: maxcamo at gmail dot com -Status: Open +Status: Feedback Bug Type: MSSQL related Operating System: Win2003 PHP Version: 5.2CVS-2009-03-05 (snap) New Comment: Have you tried to change the severity with mssql_min_message_severity? Error 5701 (Changed database context to) is at severity 10. Previous Comments: ------------------------------------------------------------------------ [2009-03-25 16:51:53] 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-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] kalle@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

« previous php.bugs (#137722) next »