[PHP-DEV] Bug #6734 Updated: SQL Error In using ODBC connection to Oracle From: kalowsky <email protected>
Date: 05/01/01

ID: 6734
Updated by: kalowsky
Reported By: eballou <email protected>
Old-Status: Feedback
Status: Closed
Bug Type: ODBC related
PHP Version: 4.0.2
Assigned To:
Comments:

no user feedback. considered fixed in current cvs. if not true, please reopen.

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

[2001-04-09 11:07:54] kalowsky <email protected>
Is this still valid in the current PHP releases?

Second, if it is, is your Oracle setup configured to allow your Win98 machine access?

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

[2000-09-14 01:23:04] eballou <email protected>
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

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>