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)
Create jdbc datasource via Design Engine API
nooshin
Dear friends
I want to develope a code to create a birt report dynamically and I want to use and oracle dataBase as the datasource.How should I create this datasource programmatically ? Can anyone help me ?
Regards
Nooshin
Find more posts tagged with
Comments
Virgil Dodson
Hi Nooshin,<br />
<br />
There is an example located at <a class='bbc_url' href='
http://www.birt-exchange.com/modules/wfdownloads/singlefile.php?cid=2&lid=317'>http://www.birt-exchange.com/modules/wfdownloads/singlefile.php?cid=2&lid=317</a><br
/>
that shows how to use the DEAPI to create a data source. This example happens entirely in Java.<br />
<br />
You could also dynamically change the data source for a report and add field to the report by using scripting and expressions in the BIRT rptdesign. An example is located at <a class='bbc_url' href='
http://www.birt-exchange.com/modules/wfdownloads/singlefile.php?cid=2&lid=117'>http://www.birt-exchange.com/modules/wfdownloads/singlefile.php?cid=2&lid=117</a>
;
Eric Wong
Dear friends,<br />
how should I do to change dataSource to Informix dataBase.<br />
<br />
that example under that link:<br />
<a class='bbc_url' href='
http://wiki.eclipse.org/Java_-_Build_Dynamic_Table_(BIRT)'>Java
- Build Dynamic Table (BIRT) - Eclipsepedia</a><br />
works perfectly.<br />
<br />
But when I change OdaDataSource property, I get the following exception:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>Exception in thread "main" java.lang.NullPointerException
at hob.integration.CreatDynamicTable.buildDataSource(CreatDynamicTable.java:37)
at hob.integration.CreatDynamicTable.buildReport(CreatDynamicTable.java:89)
at hob.integration.CreatDynamicTable.main(CreatDynamicTable.java:153)</pre>
to use Informix dataBase as dataSource, I modified the code like this:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>void buildDataSource() throws SemanticException
{
OdaDataSourceHandle dsHandle = designFactory.newOdaDataSource(
"Data Source", "org.eclipse.birt.report.data.oda.jdbc" );
dsHandle.setProperty("odaDriverClass", "com.informix.jdbc.IfxDriver");
dsHandle.setProperty(
"odaURL","mydataBaseURL");
dsHandle.setProperty("odaUser", "myDBUser");
dsHandle.setProperty("odaPassword", "myDBPassWord");
designHandle.getDataSources().add(dsHandle);
}</pre>
<br />
I have copied ifxjdbc.jar to \birt-runtime-2_3_2\ReportEngine\plugins\org.eclipse.birt.report.data.oda.jdbc_2.3.2.v20090331-1440\drivers<br />
<br />
I would be pleased to get help.<br />
<br />
Thank you.<br />
<br />
Best regards<br />
Burke
averma
Please see:
http://www.birt-exchange.org/org/forum/index.php/topic/21282-change-birt-build-dynamic-table-deapis-datasource-to-informix-database/