Greetings,

I am in need of your help. I am running PHP 4.0.6, and Oracle 8.1.7 on a Linux RedHat 7.1 system using Apache as a web server. I am using unixODBC with easySoft's Oracle driver.

I am able to select from my Oracle Tables using the following code with no trouble at all:

<?php

$dbHandle  = odbc_connect( 'dsn' , 'user', 'passwd' ); 
$resultSet = odbc_exec( $dbHandle, "SELECT ID from USER_LOGIN");
while(odbc_fetch_row($resultSet)){
 $ID = odbc_result($resultSet, 1);
 echo $ID;
}
odbc_close( $dbHandle );   

?>

Now I need to call a stored procedure using the easysoft Oracle driver as well. Anybody have any ideas? This is what I tried so far:

<?php

$dbHandle  = odbc_connect( 'dsn' , 'user', 'passwd' ); 
$resultSet = odbc_exec($dbHandle, "BEGIN database_pkg.modifyUser(0,'username','passwd');  
$retValue  = odbc_result($resultSet, 1);
odbc_close( $dbHandle );   

?>

Any help would be greatly appreciated!!

    not sure if you can call stored procedures with ODBC. Why not use the Oracle 8 functions of PHP.

      I have tried with this snipit:

      <?php

      $connection = ocilogon("username","password","sid");
      ocilogoff($connection);

      ?>

      and I get the message:

      Fatal error: Call to undefined function: ocilogon() in /data/web/theisenonline/webMaster/access/modifyUser_oracle.php on line 3

      Do I need to rebuild PHP with the with-oracle option to get this working? What else might I run into? Thanks in advance for all your suggestions.

      Steven Theisen

        The correct option is "--with-oci8=/usr/oracle" (or whatever your $ORACLE_HOME is set to).

        The only other thing to worry about is making sure the $ORACLE_HOME environment is set when you start Apache.

        Otherwise, Oracle works very well with PHP. Most of the "issues" you'll face with Oracle have to do with their non-standard SQL which won't make any difference between ODBC and native calls.

          Write a Reply...