-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thai,

Nhut Thai Le wrote:
> Servlet decument says: getDatasource(HTTPServletRequest) is used to 
> get the default datasource, getDataSource(HttpServletRequest, String)
> get the selected datasource.

This appears to be a Struts method, not anything from the servlet
specification. You need to be very specific when you quote things like
this.
http://struts.apache.org/1.2.9/api/org/apache/struts/action/Action.html#getDataSource(javax.servlet.http.HttpServletRequest)

> However, since I am using struts. following instruction in tomcat
> documentation on connection pooling and using getDatasource within a
> struts action class give a null resource because although action
> class has getDatasource(HttpServletRequest) as the httpServlet class,
> it only return resource which is managed by strut not the from
> container as the httpServlet object does.

Exactly. If you are using Tomcat-managed DataSources, you cannot use
Struts's Action.getDataSource method. You will have to write your own.
If you have a base action from which all your existing actions extend,
you can simply override getDataSource and implement it correctly for a
JNDI-based DataSource.

Better yet, separate your database queries from your Struts actions, and
forget Action.getDataSource ever existed.

> I'm now letting struts manages the resource. My problem is partly
> solved for now.

You should NOT do this. Struts has abandoned DataSource management as of
version 1.3 in favor of container-managed DataSources (as it should have
been all along). You should get Tomcat-based DataSource management
working. We will help you, though I'm guessing that this thread is over
and nobody will read this follow-up. :(

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGklYb9CaO5/Lv0PARAmWpAJ9TJ+97VfAs5PrE0C240355BixskQCgrdmY
kZK5rfPcUHqyi8bzgjTMrDg=
=Vjnk
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to