[Mondrian] how to get a fresh connection to the olap server

Julian Hyde julianhyde at speakeasy.net
Thu Apr 12 01:59:05 EDT 2007

The 'fresh' parameter is obsolete. I'll remove it.

John tells me that you are adding support for creating testcases which
have variations on the foodmart schema, and I suspect that this question
is related to that. You should investigate the TestContext.create and
TestContext.createSubstitutingCube methods, which do exactly that.

These methods create a schema string on the fly, so you'll end up with a
connection which shares another connection's catalog only in the
extremely unlikely event that another connection asked for exactly the
same catalog.

I'll add a new connect string parameter 'UseSchemaPool' for future use,
but I don't think you need it.


> -----Original Message-----
> From: mondrian-bounces at pentaho.org 
> [mailto:mondrian-bounces at pentaho.org] On Behalf Of Khanh Vu
> Sent: Wednesday, April 11, 2007 1:23 AM
> To: mondrian at pentaho.org
> Subject: [Mondrian] how to get a fresh connection to the olap server
> Hi,
> I am trying to get a fresh connection to the olap server with 
> a private schema for one of my test case. I called 
> mondrian.test.FoodMartTestCase.getConnection(boolean fresh) 
> with fresh = true. After a chain, 
> mondrian.olap.DriverManager.getConnection(...) get called. 
> Its signature is
> public static Connection getConnection(
>     Util.PropertyList properties,
>     CatalogLocator locator,
>     DataSource dataSource,
>     boolean fresh)
> The comment on top of the method says if fresh is true then a 
> new connection is created; if fresh is false then the 
> connection may come from a pool. However, the body of that 
> method does not make use of the fresh parameter at all. It 
> always returns a new RolapConnection regardless value of 
> fresh. (furthermore, that RolapConnection seems to always try 
> to get the schema from a RolapSchema.Pool). I would highly 
> appreciate if someone tell me why the fresh parameter ends up 
> not being used in that method. 
> Also, I would like to modify existing code to propagate that 
> fresh parameter down to the constructor of RolapSchema and 
> manipulate the connectionKey inside the constructor so that 
> new schema will be created for the new connection (instead 
> pulling a cached schema from the pool). Please advise if this 
> would potentially cause problems.
> Regards,
> Khanh.
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian

More information about the Mondrian mailing list