Create a singleton class, that holds the instance of a connection in a 
ThreadLocal class in that singleton --
this way you don't have to keep stuff in the session...

Regards, Alex.


On 7/6/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> 
> Hi!
> 
> I have maybe a simple question:
> 
> My web-app has to get data out of a database. I have a class 
> DatabaseHandler
> which
> holds a connection to the database and provides methods to query it. I 
> would
> like to
> have only one instance of this class in my web-app. But I don't know where
> to put it.
> Should it be stored in the ServletContext for application scope? But how 
> do
> I access
> this instance from my Actions? Or would it be better to use data-sources? 
> If
> I should
> use them, does anybody know a good tutorial on the internet? Perhaps
> hibernate would
> be a good choice too, but I think its a bit oversized for my application.
> You see - I
> am a total newbie concerning the use of databases with struts. Please
> help!!!
> 
> Peter
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

Reply via email to