Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_php thread: mysql connection question


Message #1 by "Joel Wickard" <jwickard@l...> on Mon, 1 Oct 2001 11:22:52 -0700
Well, I guess I should rephrase.

For all intents and purposes, at the end of your script, I believe you can't
"claim" ownership of a connection.  Each page has to reconnect.

I would assume it is to prevent hanging connections.

Which is very logical if you think about it.  You have 100 people go to a
page that connects to your RDBMS.  They take 5 minutes to go to the next
page.  That means you have 100 RDBMS connections locked for 5 minutes.  That
would be ugly.  Whereas with it "releasing" connections at the end of the
page, you only have those 100 connections open for seconds until the script
is loaded.

HUGE resource difference.

Adam Lang
Systems Engineer
Rutgers Casualty Insurance Company
http://www.rutgersinsurance.com
----- Original Message -----
From: "nop@p..." <nop@p...>
To: "professional php" <pro_php@p...>
Sent: Monday, October 01, 2001 10:54 PM
Subject: [pro_php] Re: mysql connection question


> Hello all,
>
>     The difference between mysql_connect and mysql_pconnect
> is the mysql_connect will automatically close when end of script
> but the mysql_pconnect won't. And if you use mysql_pconnect the
> connect will be shared. So to resume the connection by using
> session to store the connect resource maybe fail If the connection
> is being used by another session.
>     But I have no proof. It is just my conclusion from documents.
>
> Nop
>
> ----- Original Message -----
> From: "Joel Wickard" <jwickard@l...>
> To: "professional php" <pro_php@p...>
> Sent: Tuesday, October 02, 2001 1:22 AM
> Subject: [pro_php] mysql connection question
>
>
> >
> > Hello All,
> >
> > My name is Joel Wickard.  I joined the mailing lists about a week ago,
and
> > was going to introduce myself at the Oct. 10th meeting, but  I came up
> with
> > a question though before hand, so I thought I might as well ask the
group
> > and introduce myself now.  I'm interested in meeting local php users,
(and
> > linux users, I know php is not a requirement of linux, but I'm just
hoping
> > that there's a connection)  Anyway. I'm going to save anything else for
> the
> > October meeting.
> >
> > My question is this:
> >
> > I'd like to at the beginning of a user session, give the user two links,
> to
> > two seperate databases, and let them carry those links around with them
> > through the session object, and make queries to each database, when
> needed.
> > I believe I tried this once before a couple of months ago with no real
> > success.  The problem I encounter is that the linkid of the second
> > connection I open to the database, overrides the link to the first
> > connection, making the first one useless.  I have a feeling, (or a dim
> hope)
> > that theres something that I can change in the environment setup up to
> take
> > care of this.  I'm running php4.0.6 and mysql 3.23.46.  Any input would
be
> > great.
> >
> > Second:
> > Can anyone offer any input on witch method of connecting to the database
> > would carry more overhead?  Having a user carry around two connections
to
> > the database throghout their session, or,  having a user open and close
> > connections to the database repeatedly for each page.
> >
> > Thanks.
> >
> >
>
>
>




  Return to Index