commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Kelly <m.f.ke...@arts.ac.uk>
Subject Re: DBCP - not closing connections?
Date Tue, 08 Nov 2005 09:23:48 GMT
Hi David,

You are right about dong it the hard way! Unfortunately I don't have 
access to the Tomcat setup on the server, because my application is a 
plugin inside another web app, which is running on a hosted service.

I will push for access to add a datasource as in your example, but in 
the meantime I have no option but to do things this way.

The other points are well taken. This application was written when I was 
a (complete) beginner and will be refactored if time allows.

Thanks,

Mike

David Graham wrote:
> MIke,
> You are really doing this the hard way.  Since you are using JSP that
> means you're app is running in a web container.  All containers support
> configuring a DataSource in JNDI and looking it up from there.  Tomcat is
> especially easy to setup.
> 
> Here are the instructions for Tomcat 5.5 (other versions are similar but
> different):
> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
> 
> Once you're using a DataSource from the container's JNDI directory you can
> cleanup the JDBC code.  Querying the database from a JSP is bad form.  The
> JSP should *only* be handling the display logic, not the query logic. 
> Queries generally belong in a Java bean.
> 
> However, if you still want to query the database from your JSP, please use
> the standard sql tags in the JSTL.  The Tomcat link above has an example
> usage.  Also, here's a couple links to get you started.
> 
> Sun's JSTL Homepage:
> http://java.sun.com/products/jsp/jstl/
> 
> Apache Taglib implementation of JSTL:
> http://jakarta.apache.org/taglibs/
> 
> 
> David
> 
> 
> --- Mike Kelly <m.f.kelly@arts.ac.uk> wrote:


-- 


Mike Kelly
Multimedia Developer
IT Research and Development Unit
University of the Arts London
020 7514 6206


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


Mime
View raw message