Skip to main content



      Home
Home » Archived » BIRT » change report query based on connected database
change report query based on connected database [message #721756] Fri, 02 September 2011 14:23 Go to next message
Eclipse UserFriend
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 :

task.getAppContext().put("OdaJDBCDriverPassInConnection", this.conn.getConnection()); 


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 ?
Can i modify the query directly in the report event with JavaScript ?


Thanks.
Re: change report query based on connected database [message #722200 is a reply to message #721756] Sun, 04 September 2011 23:38 Go to previous messageGo to next message
Eclipse UserFriend
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.

Thanks
Re: change report query based on connected database [message #722676 is a reply to message #722200] Tue, 06 September 2011 09:56 Go to previous message
Eclipse UserFriend
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";

Jason

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.
> Thanks
Previous Topic:connetion profile proplem
Next Topic:BIRT Cross Tab
Goto Forum:
  


Current Time: Wed Jul 23 08:38:31 EDT 2025

Powered by FUDForum. Page generated in 0.03922 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top