Discussions
Categories
Choose a Product
THRUST SERVICES
CORE APPS
CE PRODUCTS
...
Quick Links
POPULAR
HELPFUL TIPS
Groups
My Links
FOR SIGNED IN MEMBERS:
Back to website
Home
Designing Analytics Reports
Paramater scripting execute dataset for defaultlist errors
Migrateduser
Hello,
I am working on report requirement to pre select all the elements in the parameter list. I am trying the paramater scripting to dynamically build data source and dataset and execute the SQL to get all the paramaters elements to be selected in the list. But its throwing errors.
JavaException: org.eclipse.birt.data.engine.odaconsumer.OdaDataException: Cannot open the connection for the driver: org.eclipse.birt.report.data.oda.jdbc.
org.eclipse.birt.report.data.oda.jdbc.JDBCException: Cannot load JDBC Driver class: Actuate-bundled MySQL5.1 Driver.
This code is shared in the BIRT roadshow in NY
try{
rsArr= [];
importPackage(Packages.java.lang);
importPackage(Packages.java.util);
importPackage(Packages.org.eclipse.birt.data.engine.api);
importPackage(Packages.org.eclipse.birt.report.model.api);
importPackage(Packages.org.eclipse.birt.data.engine.api.querydefn);
importPackage(Packages.org.eclipse.birt.data.engine.core);
logToDebugWindow("In the initalize() method");
var myconfig = reportContext.getReportRunnable().getReportEngine().getConfig();
var de = DataEngine.newDataEngine( myconfig, null );
var dsrc = reportContext.getDesignHandle().findDataSource("Data Source RDS");
var dset = reportContext.getDesignHandle().findDataSet("Main Data Set");
var odaDataSource = new OdaDataSourceDesign( "Test Data Source" );
logToDebugWindow(dsrc);
odaDataSource.setExtensionID( "org.eclipse.birt.report.data.oda.jdbc" );
odaDataSource.addPublicProperty( "odaURL","jdbc:mysql://db-goog-me..rds.amazonaws.com:3354/fooservers" );
odaDataSource.addPublicProperty( "odaDriverClass", "Actuate-bundled MySQL5.1 Driver"); // throws error
odaDataSource.addPublicProperty( "odaUser", "goog");
odaDataSource.addPublicProperty( "odaPassword", "foobar" );
//logToDebugWindow(dsrc.getProperty("odaDriverClass").toString()); // thows error cant use toString of null
var odaDataSet = new OdaDataSetDesign( "Test Data Set" );
odaDataSet.setDataSource( odaDataSource.getName( ) );
odaDataSet.setExtensionID( "org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" );
odaDataSet.setQueryText( dset.getQueryText() );
de.defineDataSource( odaDataSource );
de.defineDataSet( odaDataSet );
queryDefinition = new QueryDefinition( );
queryDefinition.setDataSetName( odaDataSet.getName() );
queryDefinition.setAutoBinding(true);
var pq = de.prepare( queryDefinition );
var qr = pq.execute( null );
var ri = qr.getResultIterator( );
var cc = ri.getResultMetaData().getColumnCount();
var rsmd = ri.getResultMetaData();
var jj = 0;
while ( ri.next( ) )
{
rsArr[jj] = ri.getValue(rsmd.getColumnName(1)).toString();
jj++;
}
ri.close( );
qr.close( );
de.shutdown( );
}catch(e){
logToDebugWindow(e);
}
rsArr;
Find more posts tagged with
Comments
There are no comments yet