I have the following code in PRD, this code is greatly simplified for the real one:
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
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;
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