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)
How do I use a parameter in my Datasource?
mkdz
<p>I would like to use a parameter in my datasource. I found a stackoverflow post about it:</p><p><a data-ipb='nomediaparse' href='
http://stackoverflow.com/questions/7345272/birt-part-of-datasource-as-parameter'>http://stackoverflow.com/questions/7345272/birt-part-of-datasource-as-parameter</a></p><p>I
tried this by putting in my<strong> Database URL</strong>:</p><p> </p><p></p><p> </p><p> </p><p>Then I created a parameter called <strong>database</strong>.</p><p> </p><p>However, when I run my report, I get errors about not being able to establish a connection to the database.</p><p> </p><p>I also found this post:</p><p><a data-ipb='nomediaparse' href='
http://www.birt-exchange.org/forum/index.php?/topic/21959-report-parameters-and-datasource-property-bindings/'>http://www.birt-exchange.org/forum/index.php?/topic/21959-report-parameters-and-datasource-property-bindings/</a></p><p>It
says to edit the <strong>JDBC Driver URL</strong> under <strong>Property Binding</strong> in the <strong>Edit Data Source </strong>dialog, but what do I put into the <strong>Database URL </strong>under the <strong>BIRT JDBC Data Source</strong> window?</p><p> </p><p>Thanks!</p>
Find more posts tagged with
Comments
mkdz
<p>What the? I can't get my Database URL to show up in my post above. Anyway, this is what I'm using as my Database URL:</p><p> </p><blockquote class="ipsBlockquote"><p></p><p> </p></blockquote>
rawesso
<p>Hope you noticed the URL still doesn't show</p>
mkdz
<p>Goddamnit. I don't know why that's happening. Here's a screenshot:</p><p> </p><p><img src='
http://i.imgur.com/RNTuFpU.png'
alt='Posted Image' class='bbc_img' /></p>
kclark
<p>You can change this in the beforeOpen() of the data source.</p><pre class="_prettyXprint">this.setExtensionProperty("odaURL", "...url..." + params["param"].value + "...url..");</pre><p>Can you try that and let me know if it works?</p>
mkdz
<p>I put this in my beforeOpen() for the datasource:</p><p> </p><p> </p><p> </p><p><span>I still get the same error:</span></p><p> </p><div><div>An exception occurred during processing. Please see the following message for details:
Failed to prepare the query execution for the data set: survey_info
Failed to prepare the following query for the data set type (org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet).
[select
*
from
reporting.fn_survey_info(?)]
org.eclipse.datatools.connectivity.oda.consumer.helper.OdaHelperException: The established connection to the data source is not active.<pre> </pre></div></div><p> </p><p> </p><p>Should I have changed anything in the <strong>Database URL</strong> part of my data source?</p>
kclark
<p>What version of BIRT are you using? I put this in my beforeOpen()</p><pre class="_prettyXprint">this.setExtensionProperty("odaURL", "jdbc : mysql : / /" + params["URL"].value + ":3306/classicmodels")</pre><p>Note I changed the URL for the code block because the URL is showing up blank right now.</p>
mkdz
<p>I'm using BIRT 4.3.0</p>
mkdz
<p>Any other advice on this? Putting:</p><pre>this.setExtensionProperty("odaURL", "jdbc : mysql : / /" + params["database"].value + ":3306/bfms")</pre><p>[color=rgb(102,102,0);]in my Data Source beforeOpen() still doesn't work.[/color]</p>
kclark
<p>Can you try this in 4.2 to see if you can rule out a bug in 4.3?</p>
mkdz
<p>Ok, I will try this in 4.2.</p>
mkdz
<blockquote class="ipsBlockquote" data-author="kclark" data-cid="120027" data-time="1378744320"><div><p>Can you try this in 4.2 to see if you can rule out a bug in 4.3?</p></div></blockquote><p>I still get the same error in 4.2. Do you have a sample report I could try out?</p>
mkdz
<p>Any more options on this?</p>
kclark
<p>I've attached an example that works for me in postgres 9.1 using the JDBC 4 driver and I'm using BIRT 4.3</p>
mkdz
<p>Well I got it working. I think I probably had a typo somewhere and just couldn't see it. Thanks a bunch!</p>
kclark
<p>No problem, glad it's working now!
</p>