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.
