|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-09-22 10:52 UTC] matthew dot berry at wolseley dot co dot uk
Description:
------------
We are using Unix, Apache version 2.0.54 and PHP 5.1.2 to connect to a database (Northgate Reality) using the Unix ODBC protocol and the Northgate Unix driver.
When we run the SQL statement shown below through ISQL on the web server, the expected results are returned.
When we run the PHP page directly on the command line using the PHP parser, we get the html generated correctly.
When going through Apache we get the following error:
Warning: odbc_do() [function.odbc-do]: SQL error: [Northgate][SNI] Transport Error : Receive Failure, SQL state 08S01 in SQLExecDirect in /sites/intranet/wuk/TermsReview/connecttest3.php on line 62
Which is a generic error message.
Part of the code used is shown below:
Reproduce code:
---------------
$rfp = odbc_connect($rdsn,$ruser,$rpwd);
if($rfp){
echo "Connected to ".$rdsn."<br>";
$select = "SELECT ACCOUNT_NO, CUSTOMER_NAME FROM GLOBAL_CUSTOMER_DETAILS WHERE ACCOUNT_NO = '7459C30'";
echo $select."<br>";
$result = ODBC_DO($rfp,$select);
etc etc
Expected result:
----------------
The message is produced when it hits the ODBC_DO statement, the connection to the database succeeds and has been traced.
I have tried several things such as using a persistant connection, using odbc_prepare before it (which also fails).
When I include phpinfo at the end it shows that there is an active odbc connection.
I realise that his could be a driver issue (although tracing has shown otherwise thus far). But the fact that running the exact same page from the command line works but doesn't through Apache means something ain't quite right.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 29 16:00:02 2025 UTC |
This problem also occurs under Windows XP Professional with PHP version 5.2.3 and Apache version 2.2.4. The DSN references a SQL Server database on a remote machine, and the PHP program works from the command line but reports an error in the connection when executing through Apache. The following will generate the message "Error in connection" when viewed as a web page. <html> <body> <?php $dsn = "myDSN"; $user = "username"; $upasswd = "password"; $conn = odbc_connect($dsn, $user, $upasswd); echo "Connecting to database '$dsn'...<BR>"; if (!$conn) { echo "Error in connection<BR>"; exit; } ?> </body> </html>