Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Paramater scripting execute dataset for defaultlist errors
abhiallen
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
kclark
What version of BIRT are you using and where are you putting this code?
abhiallen
<blockquote class='ipsBlockquote' data-author="'kclark'" data-cid="112148" data-time="1354815484" data-date="06 December 2012 - 10:38 AM"><p>
What version of BIRT are you using and where are you putting this code?<br /></p></blockquote>
<br />
<br />
The error were due to the driver name and has been resolved now. thanks for replying.