|
|
|
> I can't seem to figure out WHAT the heck I am doing wrong!!!! Argh! Can
> someone explain the PHP code required to OPEN and CLOSE persistent
> connections to Oracle?
>
> I am assuming that in each page I want to connect, I use ora_plogon.....I
> think I get that.....then, since it is persistent, I should NOT close it
> at the end of the page.......makes sense. However, I can do NO
> transaction management from persistent connections (attempts to rollback
> or commit cause PHP warnings and no results) and I often get the following
> on attempts to connect:
>
> PHP 3 Warning: Unable to open new cursor (ORA-01012: not logged on) in
> /open_database.php on line 20
On every page you should be doing something like the following:
putenv("ORACLE_HOME=/some/path");
putenv("ORACLE_SID=whatever");
$connection = ora_plogon($user,$password);
ora_CommitOn($connection);
And then when you want to execute a query, do:
(I am using the two-step process here)
$r = ora_open($connection);
if(ora_parse($r,$sql_query) < 0) {
if (ora_errorcode($r))
echo ora_errorcode($r).":".ora_error($r)."<br>$sql_query<P>\n";
} else {
ora_exec($r);
if (ora_errorcode($r))
echo ora_errorcode($r).":".ora_error($r)."<br>$sql_query<P>\n";
}
then do whatever you need to do with the result and when you are done
call:
ora_close($r);
Not super-intuitive, I know, but then again, Oracle never was.
|
|
| Ora_Bind -- bind a PHP variable to an Oracle parameter Categories : PHP, PHP Functions, Oracle | | | normalize fields and strings used in where (command's Sql) Categories : PHP, Databases, Oracle, Functions | | | Configuring PHP 4 with Oracle support Categories : PHP Configuration, Oracle | | | Installing Oracle support to PHP running in Apache Categories : PHP Configuration, Apache, Oracle, Databases, Web Servers | | | StoredProcedure, Stored Procedure, Oracle, OCI8, OCI8i Categories : OCI8, Oracle, Databases, PHP | | | Ora_CommitOn Ora_CommitOff commit rollback database SQL Oracle Categories : Oracle, PHP | | | Connecting to Oracle with php3 Categories : Oracle, PHP, Databases | | | How to limit the number of records returned by an ORACLE query? Categories : Databases, Oracle | | | Simple class for accessing databases like MSSql Server, Oracle etc by Raju Categories : PHP, MS SQL Server, Databases, PHP Classes, Oracle | | | PHP CLASS for ORACLE (database connectivity) Categories : PHP, PHP Classes, Classes and Objects, Databases, Oracle | | | A database abstraction layer for the PHP Oracle 8 module (available from PHP 3.0.5). It supports persistent connections, fetching rows into arrays, prepare/execute (variable binding) and has a new and improved error interface. Categories : Databases, Oracle, PHP, Arrays, Variables | |
|
|
|