You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@empire-db.apache.org by exxos <ha...@gmail.com> on 2010/08/24 00:43:12 UTC

About the DBDatabase instance opened in a web application

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.

re: About the DBDatabase instance opened in a web application

Posted by Rainer Döbele <do...@esteam.de>.
Excactly.

 

from: exxos [mailto:hatufr@gmail.com] 
to: empire-db-user@incubator.apache.org
re: Re: About the DBDatabase instance opened in a web application

 

Hi Rainer,

Thank you very much for your explanation.

To summarize, only one db instance (DBDatabase.open) is required for the whole application. The result can be stored in a static context or in the session of the application (i.e. static class)

Do we understand each other?

Regards,
exxos.




On Thu, Aug 26, 2010 at 8:33 PM, Rainer Dbele <do...@esteam.de> wrote:

Hi exxos,

sorry but I have been on a business trip and not been able to answer.

The intention is to open the database once in the startup code of your application, i.e. when the webapp is started on the application server and before handling any requests.

We then normally first check whether the actual data model of the db matches your internal data model object, either by comparing each table and column (there is some code to do that supplied with the Oracle driver) or simply by storing a version stamp in a special table and comparing this version stamp to ours.

As the DBDatabase.open does not keep the supplied connection you should return it back to your connection pool after the open has been performed. For each request you should then obtain a connection from the pool and use it for the entire request (in opposition to fetch a new connection for every operation and return it immediately). We normally see the whole request as a transaction that we either commit or rollback at the end of the request, depending on whether an error occurred or not.

For simplicity and to be able to make the connection configurable in our config file, we do not use a connection pool in our web exsamples but of course we recommend to do so and the overall layout of your empire-db-example-struts2 is quite a good example for that. 

All you need to with this example is to create a connection pool and provide a different implementation for the getPooledConnection() and releaseConnection(Connection conn) in the class org.apache.empire.struts2.websample.web.SampleApplication to obtain and return a connection from the pool rather then use the static one that we create at the start and that is held on the application object.

Every time a connection is needed it is then fetched via the SampleRequest object, which requests it once and release it when the request ends and exit is called.

I hope this answers your question.

Regards

Rainer

from: exxos [mailto:hatufr@gmail.com] 

to: empire-db-user@incubator.apache.org

re: Re: About the DBDatabase instance opened in a web application

Hi Rainer,

We need your opinion on that. Could you please add a comment, it will be great?

Regards,
exxos.

On Tue, Aug 24, 2010 at 10:12 AM, Francis De Brabandere <fr...@gmail.com> wrote:

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 <ha...@gmail.com> 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 <fr...@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
>> <fr...@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 <ha...@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.
>
>



--

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

 


Re: About the DBDatabase instance opened in a web application

Posted by exxos <ha...@gmail.com>.
Hi Rainer,

Thank you very much for your explanation.

To summarize, only one db instance (DBDatabase.open) is required for the
whole application. The result can be stored in a static context or in the
session of the application (i.e. static class)

Do we understand each other?

Regards,
exxos.



On Thu, Aug 26, 2010 at 8:33 PM, Rainer Döbele <do...@esteam.de> wrote:

>  Hi exxos,
>
>
>
> sorry but I have been on a business trip and not been able to answer.
>
>
>
> The intention is to open the database once in the startup code of your
> application, i.e. when the webapp is started on the application server and
> before handling any requests.
>
> We then normally first check whether the actual data model of the db
> matches your internal data model object, either by comparing each table and
> column (there is some code to do that supplied with the Oracle driver) or
> simply by storing a version stamp in a special table and comparing this
> version stamp to ours.
>
>
>
> As the DBDatabase.open does not keep the supplied connection you should
> return it back to your connection pool after the open has been performed.
> For each request you should then obtain a connection from the pool and use
> it for the entire request (in opposition to fetch a new connection for every
> operation and return it immediately). We normally see the whole request as a
> transaction that we either commit or rollback at the end of the request,
> depending on whether an error occurred or not.
>
>
>
> For simplicity and to be able to make the connection configurable in our
> config file, we do not use a connection pool in our web exsamples but of
> course we recommend to do so and the overall layout of your
> empire-db-example-struts2 is quite a good example for that.
>
> All you need to with this example is to create a connection pool and
> provide a different implementation for the getPooledConnection() and
> releaseConnection(Connection conn) in the class
> org.apache.empire.struts2.websample.web.SampleApplication to obtain and
> return a connection from the pool rather then use the static one that we
> create at the start and that is held on the application object.
>
> Every time a connection is needed it is then fetched via the SampleRequest
> object, which requests it once and release it when the request ends and exit
> is called.
>
>
>
> I hope this answers your question.
>
> Regards
>
> Rainer
>
>
>
>
>
> *from:* exxos [mailto:hatufr@gmail.com]
> *to:* empire-db-user@incubator.apache.org
> *re:* Re: About the DBDatabase instance opened in a web application
>
>
>
> Hi Rainer,
>
> We need your opinion on that. Could you please add a comment, it will be
> great?
>
> Regards,
> exxos.
>
> On Tue, Aug 24, 2010 at 10:12 AM, Francis De Brabandere <
> francisdb@gmail.com> wrote:
>
> 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 <ha...@gmail.com> 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 <
> 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
> >> <fr...@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 <ha...@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.
> >
> >
>
>
>   --
>
> http://www.somatik.be
> Microsoft gives you windows, Linux gives you the whole house.
>
>
>

re: About the DBDatabase instance opened in a web application

Posted by Rainer Döbele <do...@esteam.de>.
Hi exxos,

 

sorry but I have been on a business trip and not been able to answer.

 

The intention is to open the database once in the startup code of your application, i.e. when the webapp is started on the application server and before handling any requests.

We then normally first check whether the actual data model of the db matches your internal data model object, either by comparing each table and column (there is some code to do that supplied with the Oracle driver) or simply by storing a version stamp in a special table and comparing this version stamp to ours.

 

As the DBDatabase.open does not keep the supplied connection you should return it back to your connection pool after the open has been performed. For each request you should then obtain a connection from the pool and use it for the entire request (in opposition to fetch a new connection for every operation and return it immediately). We normally see the whole request as a transaction that we either commit or rollback at the end of the request, depending on whether an error occurred or not.

 

For simplicity and to be able to make the connection configurable in our config file, we do not use a connection pool in our web exsamples but of course we recommend to do so and the overall layout of your empire-db-example-struts2 is quite a good example for that. 

All you need to with this example is to create a connection pool and provide a different implementation for the getPooledConnection() and releaseConnection(Connection conn) in the class org.apache.empire.struts2.websample.web.SampleApplication to obtain and return a connection from the pool rather then use the static one that we create at the start and that is held on the application object.

Every time a connection is needed it is then fetched via the SampleRequest object, which requests it once and release it when the request ends and exit is called.

 

I hope this answers your question.

Regards

Rainer

 

 

from: exxos [mailto:hatufr@gmail.com] 
to: empire-db-user@incubator.apache.org
re: Re: About the DBDatabase instance opened in a web application

 

Hi Rainer,

We need your opinion on that. Could you please add a comment, it will be great?

Regards,
exxos.

On Tue, Aug 24, 2010 at 10:12 AM, Francis De Brabandere <fr...@gmail.com> wrote:

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 <ha...@gmail.com> 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 <fr...@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
>> <fr...@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 <ha...@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.
>
>




--

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

 


Re: About the DBDatabase instance opened in a web application

Posted by exxos <ha...@gmail.com>.
Hi Rainer,

We need your opinion on that. Could you please add a comment, it will be
great?

Regards,
exxos.

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

> 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 <ha...@gmail.com> 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 <
> 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
> >> <fr...@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 <ha...@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.
> >
> >
>
>
>
> --
> http://www.somatik.be
> Microsoft gives you windows, Linux gives you the whole house.
>

Re: About the DBDatabase instance opened in a web application

Posted by Francis De Brabandere <fr...@gmail.com>.
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 <ha...@gmail.com> 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 <fr...@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
>> <fr...@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 <ha...@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.
>
>



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

Re: About the DBDatabase instance opened in a web application

Posted by exxos <ha...@gmail.com>.
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
<fr...@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
> <fr...@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 <ha...@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.
>

Re: About the DBDatabase instance opened in a web application

Posted by Francis De Brabandere <fr...@gmail.com>.
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
<fr...@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 <ha...@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.

Re: About the DBDatabase instance opened in a web application

Posted by Francis De Brabandere <fr...@gmail.com>.
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 <ha...@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.