Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Change report query based on connected database
aleroot
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 (BIRT Runtime 3.7) i pass the JDBC connection object with a code like this : <br />
<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>task.getAppContext().put("OdaJDBCDriverPassInConnection", this.conn.getConnection());</pre>
<br />
<br />
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 ...<br />
<br />
Is there a way for change the entire query or a part of it based on the database server type linked to the connection ? <br />
<br />
How can i do it ?<br />
Can i modify the query directly in the report event with JavaScript ? <br />
<br />
<br />
Thanks.
Find more posts tagged with
Comments
Megha Nidhi Dahal
<blockquote class='ipsBlockquote' data-author="'aleroot'" data-cid="82273" data-time="1315040254" data-date="03 September 2011 - 01:57 AM"><p>
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 (BIRT Runtime 3.7) i pass the JDBC connection object with a code like this : <br />
<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>task.getAppContext().put("OdaJDBCDriverPassInConnection", this.conn.getConnection());</pre>
<br />
<br />
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 ...<br />
<br />
Is there a way for change the entire query or a part of it based on the database server type linked to the connection ? <br />
<br />
How can i do it ?<br />
Can i modify the query directly in the report event with JavaScript ? <br />
Thanks.<br /></p></blockquote>
<br />
Hi,<br />
<br />
You can modify your querytext using JavaScript API. On the brforeOpen method of the dataSet you can handle. Otherwise, you could pass the whole querytext as well as a parameter to the dataSet, check out your data set parameters if it supports that. <br />
<br />
Arpan