BIRT的dataSet,dataSource的创建
1.创建数据源
数据源别名 "aaa"
OdaDataSourceHandle dsHandle = efactory.newOdaDataSource(
数据源别名aaa, "org.eclipse.birt.report.data.oda.jdbc" );
dsHandle.setProperty( "odaDriverClass", "com.mysql.jdbc.Driver" );
dsHandle.setProperty( "odaURL", "jdbc:mysql://localhost:3305/数据库名" );
dsHandle.setProperty( "odaUser", "用户名" );
dsHandle.setProperty( "odaPassword", "密码" );
designHandle.getDataSources( ).add( dsHandle );
2.创建数据集
a.OdaDataSet
OdaDataSetHandle dsHandle = efactory.newOdaDataSet( 数据集合别名bbb,
"org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" );
dsHandle.setDataSource( 已创建的数据源别名aaa);
String qry = sql;
dsHandle.setQueryText( qry );
designHandle.getDataSets( ).add( dsHandle );
b.ScriptDataSet
ScriptDataSetHandle dsHandle = efactory.newScriptDataSet(数据集合别名bbb);
dsHandle.setDataSource(数据源别名aaa);
designHandle.getDataSets().add(dsHandle);