[Mondrian] SqlStatement not closed

Julian Hyde jhyde at pentaho.com
Tue Sep 29 16:52:27 EDT 2009

By design, you do not need to call close if executeQuery encounters an
exception. SqlStatement.execute should do it automatically. The code assumes
that this is the case. Is this not happening? Maybe you're getting a
throwable which is not a SQLException.
If executeQuery succeeds, you do need to call close.
 By the way,  <http://jira.pentaho.com/browse/MONDRIAN-623>
http://jira.pentaho.com/browse/MONDRIAN-623 may be the same issue as you are


From: mondrian-bounces at pentaho.org [mailto:mondrian-bounces at pentaho.org] On
Behalf Of Matt Campbell
Sent: Tuesday, September 29, 2009 12:58 PM
To: Mondrian developer mailing list
Subject: [Mondrian] SqlStatement not closed

There are several places in the code base where RolapUtil.executeQuery() is
called outside of a try/catch/finally.  Since the statement .close() method
is typically called in the finally, this has the potential to cause
statements to be left open if an exception is thrown during the

We recently experienced this when we had a series of SQL queries fail with
an exception.  Each of those failures left the statement open, which meant
that the Semaphore never incremented its query count.  I think if the query
fails it should still close the statement.

Can/should we move the executeQuery() to within the try block in the handful
of places where it is invoked?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20090929/d9dc804b/attachment.html 

More information about the Mondrian mailing list