Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: jndiConnectionProvider.setConnectionPath() fails

  1. #1
    Join Date
    Feb 2013
    Posts
    10

    Default jndiConnectionProvider.setConnectionPath() fails

    Hi Forum,

    I am trying to apply this post from Thomas (http://www.on-reporting.com/blog/kil...orting-slowly/), most specifically the jndiConnectionProvider part.

    I declared two datasources in my prpt file Foo and Bar.

    On the Global Scripting tab, I select ECMAScript and then hit templates, then within the init function apply the following code

    Code:
      var jndiConnectionProvider = dataFactory.getConnectionProvider();
      var conn = dataRow.get("jndiConnection");
      
      jndiConnectionProvider.setConnectionPath(conn);
    When running the preview mode in Pentaho Report Designer it works fine, when running it from within a Pentaho BI Server instance it keeps failing with the following messages in the log trace

    Code:
    Caused by: sun.org.mozilla.javascript.EcmaError: TypeError: Cannot find function setConnectionPath in object org.pentaho.reporting.platform.plugin.connection.PentahoJndiDatasourceConnectionProvider@6ca248f3.
    I suspect that dataFactory.getConnectionProvider() is returning me something it should not (null/empty?) but I don't see what's wrong I am doing here.

    Anyone has an idea ?

    --
    YGuenane

  2. #2
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    On the BI-server, the engine is configured to use a different implementation, that PentahoJndiDatasourceConnectionProvider you are seeing.

    The ugly solution to your problem is to make a "instanceof" test on whether you have the Pentaho implementation or the default implementation.
    On the pentaho one, the method you seek is called "setJndiName" and it does the same as the "setConnectionPath" method you try to call.

    This whole uglyness hopefully goes away in the next (5.1) release.
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  3. #3
    Join Date
    Feb 2013
    Posts
    10

    Default

    Thanks a lot Taqua, just what I needed.

    When you say 'This whole uglyness hopefully goes away in the next (5.1) release.' what will happen in 5.1?

    Only setJndiName() will be used ? Only setConnectionPath() ? Something else ?
    Do we have an ETA on 5.1 release date ?

    Thanks again for the trick,

  4. #4
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    I need to expand the JndiConnectionProvider interface to include setters, so that they are part of the contract. Then there will be only one API you have to worry about, and you wont have to know about what concrete implementation you work with.

    The datasource API more or less grew out of need and the common theme of "too much to do, too little time" - so it is not architectured, it just sprawled.
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.