php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6734 SQL Error In using ODBC connection to Oracle
Submitted: 2000-09-14 01:23 UTC Modified: 2001-05-01 17:08 UTC
From: eballou at wellfound dot com Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.0.2 OS: NT 4.0 SP 4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: eballou at wellfound dot com
New email:
PHP Version: OS:

 

 [2000-09-14 01:23 UTC] eballou at wellfound dot 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:\Reports\bad.php on line 19
Error in odbc_connect 
Warning: Supplied argument is not a valid ODBC result resource in D:\Reports\bad.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);
 
?>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-09 11:07 UTC] kalowsky@php.net
Is this still valid in the current PHP releases?

Second, if it is, is your Oracle setup configured to allow your Win98 machine access?
 [2001-05-01 17:08 UTC] kalowsky@php.net
no user feedback.  considered fixed in current cvs.  if not true, please reopen.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue May 06 02:01:28 2025 UTC