You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by MARTINEZ Antonio <An...@alcatel-lucent.com> on 2008/09/12 04:07:05 UTC
Close SQL connection
Hello,
I'm using JackRabbit with Jboss with transaction.
>From my test, I need to close the SQL connection in the finally block of
the transaction, otherwise run out of SQL connection.
I was wondering if there is a cleaner way of closing the connection
without doing it in the code
Thanks,
Antonio
PD: This is the code
...
import java.sql.Connection;
...
m_txTemplate.execute(new TransactionCallback() {
public Object doInTransaction(TransactionStatus st)
{
Connection connection =
m_sessionFactory.getCurrentSession().connection();
try {
execute(new SessionTemplate<Void>() {
public Void execute(Session session,
Node root) throws RepositoryException {
try {
// DO SOME MODIFICATION
// CALL save
return null;
}
});
return 0;
} catch (Exception e) { return Double.NaN;
} finally {
try {
connection.close();
} catch (SQLException e) { }
}
}
});
Re: Close SQL connection
Posted by Jukka Zitting <ju...@gmail.com>.
Hi,
On Fri, Sep 12, 2008 at 5:07 AM, MARTINEZ Antonio
<An...@alcatel-lucent.com> wrote:
> I'm using JackRabbit with Jboss with transaction.
>
> From my test, I need to close the SQL connection in the finally block of
> the transaction, otherwise run out of SQL connection.
What SQL connection are you talking about? Even when Jackrabbit is
internally configured to use a database, the client (or the
transaction manager) should never try to access that connection
directly.
BR,
Jukka Zitting