Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [birt-dev] RE: birt-dev Digest, Vol 4, Issue 4


What I want is just changing the QueryText  programmatically and  DataSource and DataSet are already setted in the in the rptdesign file,
In this state ,only the OdaDataSetHandle has the method :setQueryText ,But I don't want to use newOdaDataSet( datasetName, datasetType ) to
create a new DataSet. Can you give me some advices? Thansk!
----- Original Message -----
From: Yu Li
Sent: Monday, July 11, 2005 1:05 PM
Subject: RE: [birt-dev] RE: birt-dev Digest, Vol 4, Issue 4

If you have an existed report design file, what the difference thing that you need to do is to get the designHandle from parsing the design file.

 

SessionHandle sessionHandle = DesignEngine.newSession( locale );

ReportDesignHandle designHandle = sessionHandle.openDesign( fileName );

 

Then you can get the ElementFactory through the desginHandle and create your dataSet and dataSource as the code demonstrated below.

 

One thing need to clarify is:

 

  String odaDriverClass = "sun.jdbc.odbc.JdbcOdbcDriver";

> String odaURL = "jdbc:odbc:test";

> String odaUser = "sa";

> String odaPassword = "sa";

> datasourceHandele.setProperty( "odaDriverClass", odaDriverClass );

> datasourceHandele.setProperty( "odaURL", odaURL );

> datasourceHandele.setProperty( "odaUser", odaUser );

> datasourceHandele.setProperty( "odaPassword", odaPassword );

 

If you looked at the example given below you will find that the property names are hard coded in the code. But maybe you will get a little bit confused about where is the list of propertoes that defined on odaDataSet/odaDataSource. The method:

 

List OdaDataSource :: getExtensionPropertyDefinitionList( )

List OdaDataSet :: getExtensionPropertyDefinitionList( )

 

 

Throug the list you can get all of the properties that you can set and get on the odaDataSource/odaDataSet.

 

Thanks!

 

Ivy

 

Actuate Software ShangHai center.

498 Guoshoujing Rd.Bld 3.Suite 3301. shanghai,201203

Tel: (86)21-50270900 ext:257

Fax:(86)21-50270901

Email: yli@xxxxxxxxxxx

 

 

-----Original Message-----
From: birt-dev-bounces@xxxxxxxxxxx [mailto:birt-dev-bounces@xxxxxxxxxxx] On Behalf Of
孙帅
Sent: Monday, July 11, 2005 11:46 AM
To: For developers on the BIRT project
Subject: Re: [birt-dev] RE: birt-dev Digest, Vol 4, Issue 4

 

How can I use these codes to an existed rptdesign file?

----- Original Message -----

From: "Jianqiang Luo" <jluo@xxxxxxxxxxx>

To: <birt-dev@xxxxxxxxxxx>

Sent: Monday, July 11, 2005 11:34 AM

Subject: [birt-dev] RE: birt-dev Digest, Vol 4, Issue 4

 

 

> Following is an example to demonstrate how to add ODA-JDBC data source and data set programmatically.

>

> // 1: get ReportDesignHandle

> ReportDesignHandle reportDesignHandle = HandleAdapterFactory.getInstance( )

> .getReportDesignHandleAdapter( )

> .getReportDesignHandle( );

>

> // 2.1: create datasource handle

> String datasourceName = "datasourceSample";

> String datasourceType = "org.eclipse.birt.report.data.oda.jdbc";

> OdaDataSourceHandle datasourceHandele = reportDesignHandle.getDataSources( )

> .getElementHandle( )

> .getElementFactory( )

> .newOdaDataSource( datasourceName, datasourceType );

>

> String odaDriverClass = "sun.jdbc.odbc.JdbcOdbcDriver";

> String odaURL = "jdbc:odbc:test";

> String odaUser = "sa";

> String odaPassword = "sa";

> datasourceHandele.setProperty( "odaDriverClass", odaDriverClass );

> datasourceHandele.setProperty( "odaURL", odaURL );

> datasourceHandele.setProperty( "odaUser", odaUser );

> datasourceHandele.setProperty( "odaPassword", odaPassword );

>

> // 2.2: add above created data source element to data source slot handle

> SlotHandle datasourceSlotHandle = reportDesignHandle.getDataSources( );

> datasourceSlotHandle.add( datasourceHandele );

>

> // 3.1: create data set handle

> String datasetName = "datasetSample";

> String datasetType = "org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet";

> OdaDataSetHandle datasetHandle = reportDesignHandle.getDataSets( )

> .getElementHandle( )

> .getElementFactory( )

> .newOdaDataSet( datasetName, datasetType );

> datasetHandle.setDataSource( datasourceName );

> // assume there is a table named testTable

> datasetHandle.setQueryText( "select * from testTable" );

>

> // 3.2. add above created data set element to data set slot handle

> SlotHandle datasetSlotHandle = reportDesignHandle.getDataSets( );

> datasetSlotHandle.add( datasetHandle );

>

> You can get more information from DataSourceSelectionPage.java and DataSetBasePage.java.

>

> Thanks,

> Jianqiang

>

> -----Original Message-----

> From: birt-dev-bounces@xxxxxxxxxxx [mailto:birt-dev-bounces@xxxxxxxxxxx] On Behalf Of birt-dev-request@xxxxxxxxxxx

> Sent: 2005711 0:00

> To: birt-dev@xxxxxxxxxxx

> Subject: birt-dev Digest, Vol 4, Issue 4

>

> Send birt-dev mailing list submissions to

> birt-dev@xxxxxxxxxxx

>

> To subscribe or unsubscribe via the World Wide Web, visit

> https://dev.eclipse.org/mailman/listinfo/birt-dev

> or, via email, send a message with subject or body 'help' to

> birt-dev-request@xxxxxxxxxxx

>

> You can reach the person managing the list at

> birt-dev-owner@xxxxxxxxxxx

>

> When replying, please edit your Subject line so it is more specific

> than "Re: Contents of birt-dev digest..."

>

>

> Today's Topics:

>

>   1. How to create a datasource (Andres Felipe Gomez Mondragon)

>

>

> ----------------------------------------------------------------------

>

> Message: 1

> Date: Sat, 09 Jul 2005 19:22:41 +0000

> From: "Andres Felipe Gomez Mondragon" <andresfelipegomezm@xxxxxxxxxxx>

> Subject: [birt-dev] How to create a datasource

> To: birt-dev@xxxxxxxxxxx

> Message-ID: <BAY12-F2606D38F6C8D200F0C1FC8C4DA0@xxxxxxx>

> Content-Type: text/plain; format=flowed

>

> Hello, I need your help.

> I need to create a datasource using java code but i dont know how to write

> the datasource with the properties like driverclass, url,  user, password

> and the metadata with a query like "select code, description from conexion".

> After the results i´ll show in a table.

>

> Thanks.

>

> _________________________________________________________________

> On the road to retirement? Check out MSN Life Events for advice on how to

> get there! http://lifeevents.msn.com/category.aspx?cid=Retirement

>

>

>

> ------------------------------

>

> _______________________________________________

> birt-dev mailing list

> birt-dev@xxxxxxxxxxx

> https://dev.eclipse.org/mailman/listinfo/birt-dev

>

>

> End of birt-dev Digest, Vol 4, Issue 4

> **************************************

> _______________________________________________

> birt-dev mailing list

> birt-dev@xxxxxxxxxxx

> https://dev.eclipse.org/mailman/listinfo/birt-dev


_______________________________________________
birt-dev mailing list
birt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/birt-dev

Back to the top