ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Borland <jborl...@calpoly.edu>
Subject Re: iBatis - Connections to PostgreSQL Not Closing
Date Mon, 19 Oct 2009 18:57:04 GMT

Thank you very much for your reply.  I LOVE short and sweet compared to
overcomplicating things.

I tried this --> return (ArrayList) sqlMap.queryForList("getArtistInfo",
list); -- (had to add the cast or it was rejected for being "incompatible
types").  

This time it was rejected for: "unreported exception java.sql.SQLException;
must be caught or declared to be thrown."  Here's what finally made it
through the compiler:

===========================

ArrayList artists = null;
try
{
    artists = (ArrayList)sqlMap.queryForList("getArtistInfo", list );
}
catch(SQLException e)
{
    e.printStackTrace();
}
return artists;

===========================

Why is it required that I catch an SQLException?

Don't remember why I added the 'list' as the second parameter.  Wrote that
part some time ago and I think it was the only way I could make it work.

My new code still generates the same behavior -- Each time I run it the
number of <IDLE> database connections goes up by one and I end up with a
bunch of "Finalizing a Connection that was never closed" entries in the log.

Thanks in advance for any help you can give me with this!


Larry Meadors wrote:
> 
> This looks to me like you are *way* overcomplicating this. :-)
> 
> The method should be more like this:
> 
> public List getArtistInfo(){
>   return sqlMap.queryForList("getArtistInfo", list);
> }
> 
> Unless you have some really crazy wacky stuff going on, there should
> never be a need for you to deal with connections at that level.
> 
> Also, what's the purpose of passing in 'list' as the second parameter
> there? I don't see where it would ever be non-null.
> 
> Larry
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/iBatis---Connections-to-PostgreSQL-Not-Closing-tp25943619p25963634.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


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


Mime
View raw message