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

Haridasan T haridasan.t at gmail.com
Mon Apr 16 14:45:29 EDT 2007


May be the best approach to clear the cache is to write code in such a way
that, if the data is changed then clear cache

Appreciate your views and suggestions

Thks

<%@ page import="mondrian.rolap.*;" %>

<%

mondrian.rolap.RolapSchema.clearCache();

%>


On 4/13/07, John V. Sichi <jsichi at gmail.com> wrote:
>
> So the existing schema-edit pattern in BasicQueryTest.testBadMeasure1()
> is wrong in that it permanently edits the schema, correct?
>
> Also, what is the correct pattern to use in the case of a test which
> doesn't need to make any schema modifications, but does need a fresh
> data cache?  A while back I tried to make sure that
> BasicQueryTest.testMemberOrdinalCaching would be impervious to data
> cache pollution from previously-run tests, but looking at it now, and
> knowing that the fresh=true argument is ignored, maybe I need to do
> something else?
>
>     public void testMemberOrdinalCaching() {
>         final MondrianProperties properties =
> MondrianProperties.instance();
>
>         boolean saved = properties.CompareSiblingsByOrderKey.get();
>         properties.CompareSiblingsByOrderKey.set(true);
>         Connection conn = null;
>         try {
>             // Use a fresh connection to make sure bad member ordinals
> haven't
>             // been assigned by previous tests.
>             conn = getConnection(true);
>             TestContext context = getTestContext(conn);
>             tryMemberOrdinalCaching(context);
>         } finally {
>             properties.CompareSiblingsByOrderKey.set(saved);
>             if (conn != null) {
>                 conn.close();
>             }
>         }
>     }
>
>
> JVS
>
> Julian Hyde wrote:
> > 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.
> >
> > Julian
> >
> >> -----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
> >>
> >
> > _______________________________________________
> > Mondrian mailing list
> > Mondrian at pentaho.org
> > http://lists.pentaho.org/mailman/listinfo/mondrian
> >
>
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian
>



-- 
http://cfo-portal.blogspot.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20070417/e94a8bfd/attachment.html 


More information about the Mondrian mailing list