Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[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: 2005年7月11日 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
**************************************


Back to the top