I'm developing some report with BIRT, each report have a Dataset with an SQL query inside, then from my Java application through Report Engine API i pass the JDBC connection object with a code like this :
The database connection that the java application pass to the report task could be linked to different database server (mainly MySQL, PostgreSQL and Sql Server ), since some query are quite complex some times i need to change some expression in the query based on the database server type linked by the connection because the syntax can vary from database server to database server ...
Is there a way for change the entire query or a part of it based on the database server type linked to the connection ?
How can i do it ?
If you are not a java person I am not sure if you like this.
But there are already java frameworks available to cater to this need. Eg: Hibernate. You can use hibernate to run your query, and have a scripted dataset to render in your report.
Also in the beforeOpen script of the data set you can alter the query.
For example suppose your query was select * from orderdetails. You
could add a where clause like
this.queryText = this.queryText + " where ordernumber = 10101";
On 9/4/2011 11:38 PM, sam wrote:
> If you are not a java person I am not sure if you like this.
> But there are already java frameworks available to cater to this need.
> Eg: Hibernate. You can use hibernate to run your query, and have a
> scripted dataset to render in your report.