Hi Exxos,

I think it's better to wait for Rainer to respond on this one. I would
personally not cache the DB on application level but he has way more
experience with empire-db. Creating a class instance is cheap, and the
db.open does not do that much (select the correct database on the
connection and set up the sequence table object).

Cheers,
Francis

On Tue, Aug 24, 2010 at 9:44 AM, exxos <[email protected]> wrote:
> 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 <[email protected]>
> 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
>> <[email protected]> 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 <[email protected]> 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.
>
>



-- 
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.

Reply via email to