[prog] MySQL connections from PHP files - Close or keep it open for queries?

Conor Daly c.daly at met.ie
Tue May 3 19:42:30 EST 2005


On Sun, May 01, 2005 at 05:24:32PM +0200 or thereabouts, cafeine wrote:
> 
> I also used mysql_pconnect() in situations where my application was the
> only mySQL client. You might be interested in looking at it.

Why the "only mySQL client"?  As I understand it, $id_1 = mysql_pconnect() and
$id_2 = mysql_pconnect() will allow multiple persistent connections with
different $id, allowing different applications to communicate without
tramping on each other's toes.  

On a related note, does anyone know why my ingres_query()s will only run
consecutively?  If I run two copies of the same application in browser tabs,
one must complete before the other will happen.  It appears to be a matter
of waiting for a lock to release and this is what I thought it was (I was
taking out readlocks).  Having run an ingres_query("set lockmode session
where readlock=nolock"), I'm no longer taking out locks but still waiting
for one query to finish before the next will run.

It appears to occur when I use an ingres_...() command but persists for the
duration of the script.  For example, I did an 'ingres_connect()' followed
by a 'readfile("1.iso");' for a 10Mb file and had to wait for the file to
come through before anything else _database_ connected would occur.  It also
occurs via multiple mozilla windows/tabs and multiple Konqueror tabs.  It's
the same with MSIE multiple windows but fine with individual starts of MSIE
though I don't think MSIE reuses the same process for multiple starts. 

It seems to be related to 'session_start()' which I'm using to maintain a
login session for the user.  This seems to be browser dependent.  Eg. If I
connect with mozilla and get a login page and login, then, when I connect
with Konqueror, I get the login page again.  

I'm using php-4.2.2-17.12.legacy_ingres and httpd-2.0.40-21.17.legacy on rh9
(php-4.2.2-17.12.legacy from the fedora legacy project compiled with the
--with-ingres option for the "experimental" and apparently unmaintained
(last change was in 2000) ingres module). 

Conor
-- 
Conor Daly,                   Please avoid sending me 
Met Eireann, Glasnevin Hill,  Word or PowerPoint attachments.
Dublin 9, Ireland             http://www.fsf.org/philosophy/no-word-attachments.html
Ph +3531 8064276 Fax +3531 8064247

**********************************************************************
This e-mail and any files transmitted with it are confidential 
and intended solely for the addressee. If you have received
this email in error please notify the sender.
This e-mail message has also been scanned for the
presence of computer viruses.
**********************************************************************



More information about the Programming mailing list