best practie for open and close connection database
--001636b2ac6d80e9e70484c1c05d
Content-Type: text/plain; charset=ISO-8859-1
Hi
In my application, I opened my database from authentication handler and
close it from child exit handler. It is correct (is a best practice)? or is
a bad design?
where i can read for best practice for it?
thank's
--001636b2ac6d80e9e70484c1c05d
Content-Type: text/html; charset=ISO-8859-1
Hi<br><br>In my application, I opened my database from authentication handler and close it from child exit handler. It is correct (is a best practice)? or is a bad design?<br><br>where i can read for best practice for it?<br>
<br>thank's<br><br><br><br><br><br><br><br><br>
--001636b2ac6d80e9e70484c1c05d--
Re: best practie for open and close connection database
On 04/21/2010 12:33 PM, Felipe de Jesús Molina Bravo wrote:
> In my application, I opened my database from authentication handler and
> close it from child exit handler. It is correct (is a best practice)? or
> is a bad design?
Typically it's best practice to not close DB handles. That's why
Apache::DBI is such a popular module since it handles all of connection
caching for you.
With some databases (I'm looking at you Oracle) it's expensive to create
a new database connection so it's more important. With others (like
MySQL) it's really cheap so there's not a big penalty for not caching.
There are some cases where caching connections is actually a bad thing:
If you have too many application servers where each has a connection to
your database and thus overwhelms your database with too many
connections even though the actual load isn't overloading. But most
people in this situation will use a proxy like DBD::Gofer to manage the
DB connections.
--
Michael Peters
Plus Three, LP
Re: best practie for open and close connection database
On 04/21/10 11:33, Felipe de Jesús Molina Bravo wrote:
> Hi
>
> In my application, I opened my database from authentication handler and
> close it from child exit handler. It is correct (is a best practice)? or
> is a bad design?
>
> where i can read for best practice for it?
>
> thank's
>
>
>
Are you using Apache::DBI?
Is it a local database server or remote?
Are you almost always using the same database and user? Or mixed?
Re: best practie for open and close connection database
--0016363b888ce027f10484c34de4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
El 21 de abril de 2010 17:33, Chris Bennett
<chris [at] bennettconstruction.biz>escribi=F3:
> On 04/21/10 11:33, Felipe de Jes=FAs Molina Bravo wrote:
>
>> Hi
>>
>> In my application, I opened my database from authentication handler and
>> close it from child exit handler. It is correct (is a best practice)? or
>> is a bad design?
>>
>> where i can read for best practice for it?
>>
>> thank's
>>
>>
>>
>> Are you using Apache::DBI?
>
no ....
Is it a local database server or remote?
remote
> Are you almost always using the same database and user? Or mixed?
>
yes... I have a connection pool in database server (pgbouncer + pgsql 8.4 i=
)
thanks to all for your answares
--0016363b888ce027f10484c34de4
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<br><br><div class=3D"gmail_quote">El 21 de abril de 2010 17:33, Chris Benn=
ett <span dir=3D"ltr"><<a href=3D"mailto:chris [at] bennettconstruction.biz">=
chris [at] bennettconstruction.biz</a>></span> escribi=F3:<br><blockquote cla=
ss=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 204, 204); marg=
in: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class=3D"h5">On 04/21/10 11:33, Felipe de Jes=FAs Moli=
na Bravo wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, =
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi<br>
<br>
In my application, I opened my database from authentication handler and<br>
close it from child exit handler. It is correct (is a best practice)? or<br=
>
is a bad design?<br>
<br>
where i can read for best practice for it?<br>
<br>
thank's<br>
<br>
<br>
<br>
</blockquote></div></div>
Are you using Apache::DBI?<br></blockquote><div><br>no ....<br><br></div><b=
lockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 20=
4, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Is it a local database server or remote?=A0</blockquote><div>=A0</div><div>=
remote<br>=A0<br></div><blockquote class=3D"gmail_quote" style=3D"border-le=
ft: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: =
1ex;">
Are you almost always using the same database and user? Or mixed?<br>
</blockquote></div><br>yes... I have a connection pool in database server (=
pgbouncer + pgsql 8.4 i)<br><br><br>thanks to all for your answares<br>
--0016363b888ce027f10484c34de4--