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 = "";
		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 = "";
		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 and


-----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

To subscribe or unsubscribe via the World Wide Web, visit
or, via email, send a message with subject or body 'help' to

You can reach the person managing the list at

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.


On the road to retirement? Check out MSN Life Events for advice on how to 
get there!


birt-dev mailing list

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

Back to the top