RE: [PHP] ODBC Connection, 'The connection to the server was reset'

From: Date: Thu, 06 Jul 2000 14:22:40 +0000
Subject: RE: [PHP] ODBC Connection, 'The connection to the server was reset'
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-5219@lists.php.net to get a copy of this message
Hi Allan, I don't think this is a null issue, but I could be wrong. I believe this has to do with your driver mananger choking on the php call to the database, e.g. seeing it as a close. To verify that it is not a problem with your script, try the attached example that explicitly prepares and executes a connection (as opposed to odbc_exec or odbc_do). That tracing file is rather sparse too. I would try a database connection from another app and see what kind of tracing you get. ----example----- <? $sql="select * from Orders"; $dsn="SQLServerahill"; $conn_id=odbc_connect($dsn,"sa",""); if($result=odbc_prepare($conn_id, $sql)) { echo "preparing to execute '$sql'"; if (odbc_execute($result)) { echo "executing '$sql'"; if($num_fields=odbc_num_fields($result)>0){ odbc_result_all($result); }else{ echo "not a field returned. "; } } }else{ } echo "freeing result"; odbc_free_result($result); ?><br><? echo "closing connection $conn_id"; odbc_close($conn_id); ?> ----example----- Best regards, Andrew ---------------------------------------------------- Andrew Hill Professional Services Consultant OpenLink Software http://www.openlinksw.com Universal Database Connectivity Technology Providers -----Original Message----- From: Allan Lykke [mailto:aly@netguide.dk] Sent: Thursday, July 06, 2000 10:03 AM To: ahill@openlinksw.com; php-general@lists.php.net Subject: RE: [PHP] ODBC Connection, 'The connection to the server was reset' When I do a tracing and look at the SQL.LOG afterwards, this is what it says: --------------------------- sqlservr 82c-838 ENTER SQLAllocEnv HENV * 410F57A0 sqlservr 82c-838 EXIT SQLAllocEnv with return code 0 (SQL_SUCCESS) HENV * 0x410F57A0 ( 0x012a14f0) --------------------------- It seems to me that there is no errors here? What other debug/diagnostic tricks can I try? I read the following in the PHP FAQ: ----------------- 7.8 My PHP script works on IE and Lynx, but on Netscape some of my output is missing. When I do a "View Source" I see the content in IE but not in Netscape. Even when I telnet to port 80 directly the correct content shows up. How can this be? PHP is server-side and my browser can't possibly know that the content it is seeing is generated by PHP, so what is going on? Very good question! ;) This is a tricky little issue and it has come up twice in the past month as of this writing. Both times I ended up spending a good 20 minutes trying to figure out what the heck was going on. The answer is that both IE and Lynx ignore any NULs (\0) in the HTML stream. Netscape does not. The best way to check for this is to compile the command-line version of PHP (also known as the CGI version) and run your script from the command line and pipe it through 'od -c' and look for any \0 characters. (If you are on Windows you need to find an editor or some other program that lets you look at binary files) When Netscape sees a NUL in a file it will typically not output anything else on that line whereas both IE and Lynx will. If this issue has bitten you, congratulations! You are not alone. --------------------------- Could it be that?? That Micro$oft has put this NUL thing into IE5? Kind Regards, Allan Lykke -----Oprindelig meddelelse----- Fra: Andrew Hill [mailto:ahill@openlinksw.com] Sendt: 06 July 2000 04:42 PM Til: Allan Lykke; php-general@lists.php.net Emne: RE: [PHP] ODBC Connection, 'The connection to the server was reset' Allan, Try pulling a trace (tracing tab, ODBC Administrator) of the Microsoft driver to see what is happening. I assume you are using a Microsoft driver since you are all on Win2k. If not, there are other debug and diagnostic things we can do. Hope this helps! Best regards, Andrew ---------------------------------------------------- Andrew Hill Professional Services Consultant OpenLink Software http://www.openlinksw.com Universal Database Connectivity Technology Providers -----Original Message----- From: Allan Lykke [mailto:aly@netguide.dk] Sent: Thursday, July 06, 2000 8:49 AM To: php-general@lists.php.net Subject: [PHP] ODBC Connection, 'The connection to the server was reset' I'm a newbie to PHP (running it on a Windows 2000 Professional workstation) and trying to connect a html page to a Microsoft SQL Server database thru ODBC. The code I user is: --- $myDB = odbc_connect('dbNews','webuser','webuser'); $query = "SELECT * FROM tNews"; $result = odbc_exec($myDB, $query); $report = odbc_fetch_row($result); odbc_close($myDB); ---- if I only have the first line there is no errors, but as soon as I start to: odbc_exec, odbc_execute or odb_prepare a window pops up in my browser (MSIE5) saying: 'Internet Explorer cannot open the Internet site http://blabla. The connection with the server was reset.' Hope someone can help?! Kind Regards, Allan Lykke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#5219) next »