PDA

View Full Version : Closing JDBC Connections



coolguy982
07-03-2003, 10:43 AM
How does Mondrian close its jdbc connection? We have found a number of connections remaining open from Mondrian. Does Mondrian close them or let the session termination/timeout kill them? Also, does Mondrian automatically close the connection if an exception is thrown somewhere throughout building a pivot table? Thanks.

jhyde
07-03-2003, 04:05 PM
No. There has been a discussion about this issue on the mondrian-devel list, and RFE 764169 [https://sourceforge.net/tracker/index.php?func=detail&aid=764169&group_id=35302&atid=414616] was raised.

omaass
11-08-2004, 09:55 PM
I saw that the mentioned RFE has been closed.
But still we have the problem that JDBC connections increase with each olap.DriverManager.getConnection() and seem to not be closed even though Connection.close() is called. I had a look into class RolapConnection (which I assume is the currently used implementation of mondrian.olap.Connection) and saw that the close() method has an empty body. Does that mean that calling close() is without effect right now?
Is there another way to close pending JDBC connections?
Thanks a lot for help!

omaass
11-11-2004, 03:09 AM
I recognized after several tests that is was NOT Mondrian that opened all the DB-connections.
So, no blame on Mondrian ;-)

omaass
11-11-2004, 03:11 AM
I recognized after several tests that is was NOT Mondrian that opened all the DB-connections.
So, no blame on Mondrian ;-)

sfm93
11-19-2004, 11:41 PM
We are working on this task too. Indeed, it's not great when you have almost 2000 users.
Do you have some results of your search ? We are tracing connections and it doesn't seem easy to change the code.

jhyde
12-13-2004, 08:24 AM
sfm93,
omaass stated that his problem was with his application leaking mondrian.olap.Connection objects (which are not JDBC connections).
Mondrian gets its connections from a JDBC connection pool and, as far as I know, releases connections back to the pool in all circumstances.
Please clarify your problem.

sfm93
12-18-2004, 07:28 AM
Julian,
Insofar as the "close" method is never defined, the connection cannot be released as long as the user is connected. Thus, the connection is blocked and cannot be divided thanks to the pool.
Why rather not use the pool of the application' server (like tomcat) than to redefine one ?

jhyde
12-18-2004, 07:58 PM
I think we're at cross-purposes here.
Mondrian connections are NOT JDBC connections. (Since Mondrian is not an SQL database.)
Mondrian connections do not hold very many resources, so we leave it to the garbage-collector to free them. I guess I could add a close() method, but it wouldn't do anything.
Of course Mondrian uses JDBC connections under the covers in order to get its data. These connections are managed by a connection pool, just as you suggest. They are used for brief periods of time during Mondrian requests, and are then released back to the pool, regardless of whether the JDBC request or the Mondrian request has an error.

sfm93
12-23-2004, 12:39 AM
Sorry, you were right entirely.
Our problem wasn't a mondrian problem but another connection.
The fact that mondrian's connection is defined in static makes it possible to divide it and closing is in this case superfluous.