Keith is right, this is more likely to be your configuration in
WebSphere.
Also the JDBCTemplate will close your connection for you. If the
connection is configured as a pooled connection then the close() just
returns it to the pool.

Colin.

On Jul 31, 3:14 pm, Arulin of ACBL <[email protected]> wrote:
> Hello Java Posse,
>
> Our system Admin is tearing his hair out over JDBCtemplete, it is not
> closing threads that it opens between Websphere App Server and DB2, we
> are on an AS400/AIX based system. The system gets over 1000 threads
> that are just sitting there, I've searched the net for possible
> solutions with little luck. Is there a way of making the DAO close the
> threads safely so that JDBCTemplete isn't half doing it's job?
>
> I'll toss an example of our current the DAO...
> ***************************************************************************­****
> package learntoplaybridge.jdbc.dao;
>
> import java.sql.SQLException;
> import java.util.List;
>
> import org.acbl.utility.Util;
> import org.apache.log4j.Logger;
> import org.springframework.jdbc.core.RowMapperResultReader;
>
> public class TableJdbcDao extends AbstractJdbcDao {
>         private String sql;
>
>         private Object[] params;
>
>         private String db = (Util.getServer().equals("PROD")) ? "file.table"
>                         : "test.table";
>
>         public Table lookUpPrices(){
>                 sql = "select MNEW$, MMEM$1 from {db} order by MYYMM desc";
>                 sql = Util.replaceSubString(sql, "{db}", db);
>                 List l = getJdbcTemplate().query(sql, params, new
> RowMapperResultReader(new MEP022RowMapper()));
>                 return (l.size() > 0)? (MEP022)l.get(0) : null;
>         }
>
>         // Ensuring the data ccnnection is closed
>                 // This crashes each time we run it.
>         public void isJDBCConnectionClosed(){
>                 try {
> if(this.getDataSource().getConnection() != null && this.getDataSource
> ().getConnection().isClosed() != false) // Here dao is the Object
> reference
>                         {
>                                 this.getDataSource().getConnection().close();
>                         }
>                 } catch (SQLException e) {
>                         // TODO Auto-generated catch block
>                         e.printStackTrace();
>                 }
>         }
>
>
>
> }- Hide quoted text -
>
> - Show quoted text -

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to