incubator-empire-db-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From exxos <hat...@gmail.com>
Subject Re: About the DBDatabase instance opened in a web application
Date Tue, 24 Aug 2010 07:44:43 GMT
Hi Francis,

Just to be sure about what we are discussing here. This is about the
following steps:

MyDB db = new MyDB<DBDatabase>();
Connection conn = <DataSrouce>.getConnection();
DBDatabaseDriver driver = new DBDatabaseDriverXXX();
db.open(driver, conn);

Could you confirm that the instance "db" does not have to be put in
application session (or in a the static context).
According to your previous answer, for performance purpose, it is better to
reopen and close it for each DB request.

Thank you to confirm.

Regards,
exxos.


On Tue, Aug 24, 2010 at 1:20 AM, Francis De Brabandere
<francisdb@gmail.com>wrote:

> Oops, thats the answer to a different question but somehow still valid
> as you should return your connection to the pool at the end of the
> request.
>
> You could have a look at the SampleRequest/SampleApplication in the
> struts2 example but I have the impression that that example is not
> that great as I uses one connection on application level which is not
> what you should do on a production system.
>
> Maybe I can add a wicket or plain servlet example one day...
>
> These are all good questions :-) might add this one to the faq
>
> Rainer?
>
> Cheers,
> Francis
>
> On Tue, Aug 24, 2010 at 12:51 AM, Francis De Brabandere
> <francisdb@gmail.com> wrote:
> > Open and close on each request. For higher performance better have
> > some kind of connection pool like c3po
> > (http://http://sourceforge.net/projects/c3p0/) or apache commons dbcp
> > or whatever pooling your appserver has/supports.
> >
> > Cheers,
> > Francis
> >
> > On Tue, Aug 24, 2010 at 12:43 AM, exxos <hatufr@gmail.com> wrote:
> >> Hi,
> >>
> >> Probably a "simple" question...
> >>
> >> For a web application, what is preferable?
> >>
> >> Keeping a DBDatabase instance opened (and attached to a driver)  in the
> >> application session (as static for example) or open and close it each
> time a
> >> db request?
> >>
> >>
> >> Regards,
> >> exxos.
> >>
> >
> >
> >
> > --
> > http://www.somatik.be
> > Microsoft gives you windows, Linux gives you the whole house.
> >
>
>
>
> --
> http://www.somatik.be
> Microsoft gives you windows, Linux gives you the whole house.
>

Mime
View raw message