WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Persistent Connections and Oracle
Categories : Oracle Update Picture
Rasmus Lerdorf
Date : Oct 23rd 1998
Grade : 1 of 5 (graded 1 times)
Viewed : 3185
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Rasmus Lerdorf
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

> 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