You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Saurabh Bhatla <sa...@resolution.com> on 2004/08/16 22:54:12 UTC

connection pooling

Hi all, 
   I have just started working with struts a few days ago, and I
understand most of it. The only thing that i dont understand is, if i
make a connection pool then where will it be initialized. In servlets I
know that it can be done in the init() method but in struts framework
there is nothing like an init() method. I have the connection pool class
that i have written and i was using in one of my servlets. Now i want to
know how to initialize the connection pool object and how to pass that
object to all Action classes.

Any suggestion would be greatly appreciated.

regards
saurabh


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: connection pooling

Posted by sridhar ramalingam <sr...@fishmanconsulting.com>.
Saurabh,
If you want to do some kind of initialization when your server starts
up, you can implement the org.apache.struts.action.PlugIn interface and
override the init() method to do your initialization. Check Logon
example application,
org.apache.struts.webapp.example.memory.MemoryDatabasePlugIn.java for
more details.

Regards,
Sridhar

-----Original Message-----
From: Saurabh Bhatla [mailto:saurabh@resolution.com] 
Sent: Monday, August 16, 2004 2:24 PM
To: Struts Users Mailing List
Subject: Re: connection pooling


David,
  But i want to make a business layer and call the DAO from there.  I
think that the links that you have sent me couple presentation layer and
database tightly. I know i can use EJB for presentation layer but I dont
want that as it would be overkill for the small project I am working on.
I want to have a connection pool class initialized at the time the
server starts and then all my DAO  should get the connection from that
pool. Is it possible?
  I am a beginner in this field and I might not understand it
completely. please correct me if i am wrong. regards saurabh


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: connection pooling

Posted by Saurabh Bhatla <sa...@resolution.com>.
David,
  But i want to make a business layer and call the DAO from there.  I
think that the links that you have sent me couple presentation layer and
database tightly. I know i can use EJB for presentation layer but I dont
want that as it would be overkill for the small project I am working on.
I want to have a connection pool class initialized at the time the
server starts and then all my DAO  should get the connection from that
pool. Is it possible?
  I am a beginner in this field and I might not understand it
completely. please correct me if i am wrong.
regards
saurabh


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: connection pooling

Posted by David Durham <da...@scott.af.mil>.
David Durham wrote:

> I think you want to look at a piece of technology called JNDI.
>
> Here's a link to Tomcat's JNDI Datasource How-To:
>
> http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html


Considering the list topic, I guess I should post this link instead:

    http://struts.apache.org/faqs/database.html

- Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: connection pooling

Posted by David Durham <da...@scott.af.mil>.
Saurabh Bhatla wrote:

> Now i want to
> know how to initialize the connection pool object and how to pass that
> object to all Action classes.

I think you want to look at a piece of technology called JNDI.

Here's a link to Tomcat's JNDI Datasource How-To:

    http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html

- Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org