[jboss-dev-forums] [Deployers on JBoss (Deployers/JBoss)] - Re: Connection Error - Jboss 4.0.4 + JDK 1.5 + Pgsql-8.1.4
PeterJ
do-not-reply at jboss.com
Mon Jul 17 17:37:18 EDT 2006
This usually happens when you grab a data source and then fail to close it after you are done with it. For example, within a method for a stateless session bean, if you do:
DataSource ds = lookupDataSource();
Connectionn conn = ds.getConnection();
.. do stuff with the database ...
return;
then you have problems. Instead, you should code as:
DataSource ds = getDataSource();
Connectionn conn = ds.getConnection();
try {
.. do stuff with the database ...
} finally {
conn.close();
}
return;
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3958627#3958627
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3958627
More information about the jboss-dev-forums
mailing list