?
Solved

optimize ORA_Logon

Posted on 2002-07-15
8
Medium Priority
?
584 Views
Last Modified: 2012-05-04
I have a program which involve many php scripts.
Each of them works with a different table, so I "create" a connection in the top of each PHP.
All works fine...

What I wan´t to do is optimize the connection to Oracle, so I try to use Ora_Logon "only once", then I try to pass this connection by sessions or by "POST " params, to the other pages, but nothing works.

So the only way to make the program works is to open a connection in each PHP page.

Any idea how can I handle this situation so I can open ONLY ONE PERSISTENT connection to ORACLE?.
 
Thanks,
Fernando
0
Comment
Question by:Pampa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
8 Comments
 
LVL 5

Expert Comment

by:dkjariwala
ID: 7154154
Thats a good idea !!! :)

Though before you start the very first thing u need to verify is that your PHP is installed as module for your web server rather than acting as CGI Binary. if it is configured as CGI binary u wont be able to use persitent connection.


And if i am not mistake there is function like ora_plogon which should help you in getting persistent connection.

JD
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 7155141
Something from the php manual ...

digitalCoffee@zdnetonebox.com
04-Oct-2000 12:16
 
When using the persistent login, php obviously does not disconnect, and
therefore does not commit any changes you have made to the database.  This
results in Oracle either locking up, or returning ORA-01554 (Out of
transaction slots in transaction tables).

To resolve this, be sure to end your page with ora_commit($connection)
(passing in your $connection id).

 
Regards,

Richard Quadling.
0
 
LVL 1

Author Comment

by:Pampa
ID: 7157825
Anyone Knows how can avoid the commit of a permanent connection.
I mean somethinhg like AUTO COMMIT ???
0
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 
LVL 40

Expert Comment

by:Richard Quadling
ID: 7159016
There are three PHP commands dealing with commit for Oracle.

Ora_Commit — commit an Oracle transaction
Ora_CommitOff — disable automatic commit
Ora_CommitOn — enable automatic commit

Ora_Commit
(PHP 3, PHP 4 )

Ora_Commit -- commit an Oracle transaction
Description
int ora_commit ( int conn)


Returns TRUE on success, FALSE on error. Details about the error can be retrieved using the ora_error() and ora_errorcode() functions.

This function commits an Oracle transaction. A transaction is defined as all the changes on a given connection since the last commit/rollback, autocommit was turned off or when the connection was established.


Ora_CommitOff
(PHP 3, PHP 4 )

Ora_CommitOff -- disable automatic commit
Description
int ora_commitoff ( int conn)


Returns TRUE on success, FALSE on error. Details about the error can be retrieved using the ora_error() and ora_errorcode() functions.

This function turns off automatic commit after each ora_exec().


Ora_CommitOn
(PHP 3, PHP 4 )

Ora_CommitOn -- enable automatic commit
Description
int ora_commiton ( int conn)


This function turns on automatic commit after each ora_exec() on the given connection.

Returns TRUE on success, FALSE on error. Details about the error can be retrieved using the ora_error() and ora_errorcode() functions.




I've not used Oracle, but these commands should help you use a persistant connection AND commit the transaction on demand.

Regards,

Richard Quadling.
0
 
LVL 1

Author Comment

by:Pampa
ID: 7177691
RQuadling, I try your solution, but I still have a Big problem with persisten connections:

In my program I'am using user sessions so FIRST: I try to pass the connection as a variable of the session, but this doesn`t works.

So I create a persistent connection in EVERY PHP page. I think that this type of connections verify if the connection exists?, but this doesn`t happened¿? so I have many persistent connections with every call to the PHP page.

So I have to use the NON-persisten connections, but the performace is NOT the same.
Any idea????


 
0
 
LVL 40

Accepted Solution

by:
Richard Quadling earned 400 total points
ID: 7179591
Are you running PHP as a cgi-bin or as an ISAPI MOdule (or whatever the unix variant of this is).

Try this as info.php

<?php phpinfo(); ?>

My online site has Server API : Apache

My local webserver has Server API : ISAPI

I don't know what you get for a CGI-BIN. Maybe CGI-BIN!

If it is not compiled in (Apache) or an ISAPI, then your persistent connections will not work.

Maybe have a chat with your sysop.

Richard.
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question