struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arnaud Héritier <aherit...@sopragroup.com>
Subject RE: DB connection pool
Date Wed, 28 Nov 2001 14:59:19 GMT
Yes I understand and It is what I done in my application.

I retreive datasources from actions and passes it to my DAO.

This response was for Tom who asked how to declare several data-sources

> -----Message d'origine-----
> De:	Otavio C. Decio [SMTP:decio@mindspring.com]
> Date:	mercredi 28 novembre 2001 15:32
> À:	Struts Users Mailing List
> Objet:	Re: DB connection pool
> 
> Yes, I know, but I don't want my DAO to know anything about Actions. I like
> Tom Lister's idea, to simply pass the datasorce to the DAO.
> 
>  Thanks!
> 
> Otavio
> ----- Original Message -----
> From: "Arnaud Héritier" <aheritier@sopragroup.com>
> To: "'Struts Users Mailing List'" <struts-user@jakarta.apache.org>
> Sent: Wednesday, November 28, 2001 9:36 AM
> Subject: RE: DB connection pool
> 
> 
> In your struts-config.xml you declare all your connections pool :
> 
> <data-sources>
> <data-source>
> <set-property property="key" value="db1"/>
> ...
> </data-source>
> <data-source>
> <set-property property="key" value="db2"/>
> ...
> </data-source>
> <data-source>
> <set-property property="key" value="db3"/>
> ...
> </data-source>
> </data-sources>
> 
> Then in your Action classes you retreive your connections like this :
> 
> DataSource myDataSource1 = servlet.findDataSource("db1");
> Connection myConnection1 = myDataSource1.getConnection();
> 
> DataSource myDataSource2 = servlet.findDataSource("db2");
> Connection myConnection2 = myDataSource2.getConnection();
> 
> Arno
> 
> > -----Message d'origine-----
> > De: Tom Lister [SMTP:Tom.Lister@ABSL.COM]
> > Date: mercredi 28 novembre 2001 15:14
> > À: 'Struts Users Mailing List'
> > Objet: RE: DB connection pool
> >
> > Does anyone know how to work with multiple connection pools to different
> > databases.
> > :-)
> > Regards
> > Tom_Lister@absl.com <mailto:Tom_Lister@absl.com>
> > Advanced Banking Solutions Limited
> > +44 (0)20 7448 9146
> > -----Original Message-----
> > From: Viet Kevin [SMTP:vietk@activia.net]
> > Sent: 28 November 2001 13:43
> > To: Struts Users Mailing List
> > Subject: Re: DB connection pool
> >
> >
> > //take the DataSource from the servlet context
> >
> > DataSource datasource =
> > getServlet().getServletContext(Action.DATASOURCE_KEY);
> >
> > // and the connection
> > Connection connection = datasource.getConnection();
> >
> > Don't forget to configure your database int  the struts-config.xml
> >
> > Ciao
> >
> >
> >
> > =============================================================
> > -- KeV --
> > =============================================================
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:struts-user-help@jakarta.apache.org>
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


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


Mime
View raw message