Re: [PHP-DB] Oracle Oci*Logon

2001-08-21 Thread Graeme Merrall

Quoting Andrey Hristov <[EMAIL PROTECTED]>:

>  Can someone tell more about OciPLogon.

I'm sure Theis will add to this but here goes... :)

> I know that OciLogon is used frequently but the connection to the DB
> is
> shared amongst the pages so as in the common way where every page in a
> site
> uses one pair user/password use the only channel. When one script
> makes
> "commit" it commits all, so if two scripts subsequently made insert but
> one
> thinks that there was a fail it will issue "rollback". The problem is
> that
> the other script issued "commit" and "rollback" does nothing.
> Someone can tell that the decision is using OciNLogon - ok but I know
> that
> this is the most time consuming way to connect to Oracle.
> The refined question is: "Does OciPlogon is like OciLogon - one channel,
> one
> scripts commits/rollbacks all statements, or it is like OciNLogon but
> the
> connection is not made everytime a scripts want such but used already
> created one?".

Oracle connections work across 3 levels, the server, the session and the 
service. AFAIK, transactions work at the service level which is the 'top' 
level. Persistent connections operate at the session level. Tus a persistent 
connection is maintained across Apache children by keeping the bottom level or 
server context open.

We did run into problems because we have very high traffic sites and we have 
100 Apache children running. Because our junior programmer decided to hammer 
the server with a web stress tool, al the  children ran up connections which 
combined with connections on other web server made us run out of sessions.  
Dropping back to icologon() for a while helped the problem.

Anyway, to answer your question, persistent logins will not affect 
transactions  across processes as far as I'm aware. There may be some 
locking/isolations issues if a simultaneous read/write occurs but Oracle should 
handle that anyway.

ocinlogon() is used to guarantee an isolated connection which will not affect 
any outstanding transactions. You only usually do this when you want to do a 
seperate set of operations in the middle of a transaction in a script.

> One more question : When PHP and Oracle works on one machine to make
> all
> work the enviroment variable ORACLE_HOME has to be set for example :
> /***/
> 
> // set ORACLE Dir to get the NET8 name resolver working
> // tnsnames.ora has to be in $ORACLE_HOME/networking/admin/
> putenv("ORACLE_HOME=/home/oracle01/app/oracle/product/8.1.5");
> 

This is bad. As Theis has pointed out proviously, PHP modules perform certain 
operations at Apache startup and shutdown as well as script startup and 
shutdown. Setting things like ORACLE_HOME, NLS_LANG and so on in your script 
can cause some problems as some of the module has already been initialised 
before your script executes. You're better off putting this stuff in somewhere 
like the apachectl script.


> /***/
> 
> but if my web server is an Apache under windows and the oracle is on
> other
> machine under Linux(RH), what have to be done to make my PHP work with
> the
> DB.

Windows is a slightly different beast. Normally the environment stuff is 
handled in windows and you don't need to setup anything with putenv. Use your 
Net8 Configuration assistant which is part of the Oracle Windows client 
libraries to create the correct TNSNAMES.ORA.

AFAIK (I've never tried not to) you must specify the SID when connecting under 
windows in a PHP script.

Cheers,
 Graeme

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Oracle Oci*Logon

2001-08-21 Thread Andrey Hristov

 Can someone tell more about OciPLogon.
I know that OciLogon is used frequently but the connection to the DB is
shared amongst the pages so as in the common way where every page in a site
uses one pair user/password use the only channel. When one script makes
"commit" it commits all, so if two scripts subsequently made insert but one
thinks that there was a fail it will issue "rollback". The problem is that
the other script issued "commit" and "rollback" does nothing.
Someone can tell that the decision is using OciNLogon - ok but I know that
this is the most time consuming way to connect to Oracle.
The refined question is: "Does OciPlogon is like OciLogon - one channel, one
scripts commits/rollbacks all statements, or it is like OciNLogon but the
connection is not made everytime a scripts want such but used already
created one?".
One more question : When PHP and Oracle works on one machine to make all
work the enviroment variable ORACLE_HOME has to be set for example :
/***/

// set ORACLE Dir to get the NET8 name resolver working
// tnsnames.ora has to be in $ORACLE_HOME/networking/admin/
putenv("ORACLE_HOME=/home/oracle01/app/oracle/product/8.1.5");


/***/

but if my web server is an Apache under windows and the oracle is on other
machine under Linux(RH), what have to be done to make my PHP work with the
DB.

Many thanks.
Sincerely : Andrey Hristov


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]