best practie for open and close connection database

best practie for open and close connection database

am 21.04.2010 18:33:19 von fjmolinabravo

--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

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--

Re: best practie for open and close connection database

am 21.04.2010 18:37:47 von mpeters

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

am 21.04.2010 19:33:12 von Chris Bennett

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

am 21.04.2010 20:24:26 von fjmolinabravo

--0016363b888ce027f10484c34de4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

El 21 de abril de 2010 17:33, Chris Bennett
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



El 21 de abril de 2010 17:33, Chris Benn=
ett <=
chris@bennettconstruction.biz
>
escribi=F3:
ss=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 204, 204); marg=
in: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On 04/21/10 11:33, Felipe de Jes=FAs Moli=
na Bravo wrote:

204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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 ....

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
=A0
=
remote
=A0
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?


yes... I have a connection pool in database server (=
pgbouncer + pgsql 8.4 i)


thanks to all for your answares


--0016363b888ce027f10484c34de4--