PHP 4.0 Bug #6734 Updated: SQL Error In using ODBC connection to Oracle
| From: | kalowsky@php.net | Date: | Mon, 09 Apr 2001 15:07:55 +0000 |
| Subject: | PHP 4.0 Bug #6734 Updated: SQL Error In using ODBC connection to Oracle | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-51203@lists.php.net to get a copy of this message | ||
ID: 6734
Updated by: kalowsky
Reported By: eballou@wellfound.com
Old-Status: Open
Status: Feedback
Bug Type: ODBC related
Assigned To:
Comments:
Is this still valid in the current PHP releases?
Second, if it is, is your Oracle setup configured to allow your Win98 machine access?
Previous Comments:
---------------------------------------------------------------------------
[2000-09-14 01:23:04] eballou@wellfound.com
Installed PHP4.02 on NT 4 and 98. NT has IIS3/PWS and 98 has PWS. Install went fine on 98 after
following numerous notes. After installing on NT scripts are able to run, however I am unable to
connect to Oracle DB. I haven't figured out where the oracle module is (or how to install it
for PHP) so I use ODBC connection and script. Granted the code isn't pretty as I get errors
with the output, but it works on the 98 machine fine.
I get the following error:
Warning: SQL error: [Oracle][ODBC][Ora]Server rejected the connection., SQL state 08004 in
SQLConnect in D:Reportsbad.php on line 19
Error in odbc_connect
Warning: Supplied argument is not a valid ODBC result resource in D:Reportsbad.php on line 14
Suggestions and instructions needed.
Code also follows:
<?
//__________________________________________________________
//
// test_odbc.php3
// A sample PHP script to test ODBC under PHP / WinNT
// Leo West - 08/1998
//__________________________________________________________
function Error_Handler( $msg, $cnx )
{
echo "$msg n";
// in case of persistent connexion, it is important to close it before exiting.
odbc_free_result( $cnx);
exit();
}
// create an ODBC connection, returned in $cnx
$cnx = odbc_connect( "WebDB","SA","");
// To avoid permission troubles in the test, you may want to use a superadmin access :
// $cnx = odbc_connect( 'WebDB' , [sa login] , [sa password] );
if( ! $cnx ) {
Error_handler( "Error in odbc_connect" , $cnx );
}
// send a simple odbc query . returns an odbc cursor
$cur= odbc_exec( $cnx, "select name from matters order by name" );
if( ! $cur ) {
Error_handler( "Error in odbc_exec( no cursor returned ) " , $cnx );
}
echo "<table
border=1><tr><th>id</th><th>nom</th></tr>n";
$nbrow=0;
// fetch the succesive result rows
while( odbc_fetch_row( $cur ) )
{
$nbrow++;
// get the field "id"
$id= odbc_result( $cur, 1 );
// get the field "nom"
$nom= odbc_result( $cur, 2 );
echo "<tr><td>$id</td><td>$nom</td></tr>n";
}
echo "<tr><td colspan=2>$nbrow entries </td></tr></table>";
// close the connection. important if persistent connection are "On"
odbc_close( $cnx);
?>
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=6734&edit=2