Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Grabbing JNDI when on BI-Server for a scriptable ds

  1. #1

    Default Grabbing JNDI when on BI-Server for a scriptable ds

    I have the following code in PRD, this code is greatly simplified for the real one:

    Code:
    import javax.naming.InitialContext;
    import javax.sql.DataSource;
    import java.sql.ResultSet;
    import java.sql.Statement;
    import java.sql.Connection;
    import org.pentaho.reporting.engine.classic.core.util.TypedTableModel;
    
    
    String [] columnNames = { "Product Code" };
    Class [] columnTypes = { String.class };
    
    
    TypedTableModel model = new TypedTableModel(columnNames, columnTypes);
    
    
    InitialContext ctxt = new InitialContext();
    DataSource ds = (DataSource)ctxt.lookup("JNDI-DataSource");
    Connection c = ds.getConnection();
    
    
    ResultSet rs = c.createStatement().executeQuery("CALL SOME_RS_RETURNING_SP");
    
    
    while(rs.next()) {
    	model.addRow(new Object [] { rs.getString(1) });
    }
    
    
    c.close();
    
    
    return model;
    This works just fine in PRD. However, moving over to BI-SERVER, the JNDI name "JNDI-DataSource" cannot be found. I've even tried setting the lookup string to "java:comp/env/jdbc/JNDI-DataSource" to no avail.

    What exactly is the string I need to pass in order to grab an underlying data source from the BI Server?

    Yes I get that this method isn't exactly the fastest, but DB admins aren't being exactly helpful about things and thus I need the ability to call some stored procedures and load those into a temp table at run time.

    Thank you
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    I don't work for Pentaho, but I like their stuff.

    Justin Barrett
    This sig may be my last!

  2. #2

    Default

    Also, side note. Using BI Server 4.8, yeah I know, we're not yet up to the latest/greatest. That's in the pipe.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    I don't work for Pentaho, but I like their stuff.

    Justin Barrett
    This sig may be my last!

  3. #3

    Default

    I figured it out. I used "java:/comp/env/jdbc/JNDI-DataSource" as the lookup name for the initial context. Was able to pull the JNDI datasource then.

    Thanks!
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    I don't work for Pentaho, but I like their stuff.

    Justin Barrett
    This sig may be my last!

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.