Connection profile URL
Options
Hi,<br />
<br />
I'm having troubles with specifying a connection profile URL relative to BIRT working folder.<br />
I have my BIRT deployed under Tomcat 6 on Ubuntu machine.<br />
In my <span class='bbc_underline'>web.xml</span> file I have the birt working folder specified:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'><context-param>
<param-name>BIRT_VIEWER_WORKING_FOLDER</param-name>
<param-value>/var/lib/tomcat6/webapps/birt-viewer/energyplan</param-value>
</context-param></pre>
<br />
Then I try to specify connection profile URL using connection profile binding:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
config["birt.viewer.working.path"]+"/profilestore.dat"
</pre>
<br />
When I run the report, I get following error:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>OdaDataSet usage:
+ Error evaluating Javascript expression. Script engine error: birt.viewer.working.path not found.
Script source: <inline>, line: 0, text:
config["birt.viewer.working.path"]+"/profilestore.dat"</pre>
<br />
Also if I output javascript all config array in report like this:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>report.config</pre>
it does not mentions birt.viewer.working.path variable at all.<br />
<br />
How can I specify my connection profile store URL using relative path?<br />
Any help will be appreciated.<br />
<br />
Taras Kopets<br />
Twitter: [twitter]tkopets[/twitter]
<br />
I'm having troubles with specifying a connection profile URL relative to BIRT working folder.<br />
I have my BIRT deployed under Tomcat 6 on Ubuntu machine.<br />
In my <span class='bbc_underline'>web.xml</span> file I have the birt working folder specified:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'><context-param>
<param-name>BIRT_VIEWER_WORKING_FOLDER</param-name>
<param-value>/var/lib/tomcat6/webapps/birt-viewer/energyplan</param-value>
</context-param></pre>
<br />
Then I try to specify connection profile URL using connection profile binding:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
config["birt.viewer.working.path"]+"/profilestore.dat"
</pre>
<br />
When I run the report, I get following error:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>OdaDataSet usage:
+ Error evaluating Javascript expression. Script engine error: birt.viewer.working.path not found.
Script source: <inline>, line: 0, text:
config["birt.viewer.working.path"]+"/profilestore.dat"</pre>
<br />
Also if I output javascript all config array in report like this:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>report.config</pre>
it does not mentions birt.viewer.working.path variable at all.<br />
<br />
How can I specify my connection profile store URL using relative path?<br />
Any help will be appreciated.<br />
<br />
Taras Kopets<br />
Twitter: [twitter]tkopets[/twitter]
0
Comments
-
Hi Taras,
Does maybe using an expression to point to the connection profile work? Like in the following devShare entry?
http://www.birt-exchange.org/org/devshare/designing-birt-reports/251-dynamic-location-for-birt-connection-profile-store/Warning No formatter is installed for the format ipb0 -
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="71304" data-time="1292276589" data-date="13 December 2010 - 02:43 PM"><p>
Hi Taras,<br />
<br />
Does maybe using an expression to point to the connection profile work? Like in the following devShare entry?<br />
<br />
<a class='bbc_url' href='http://www.birt-exchange.org/org/devshare/designing-birt-reports/251-dynamic-location-for-birt-connection-profile-store/'>http://www.birt-exchange.org/org/devshare/designing-birt-reports/251-dynamic-location-for-birt-connection-profile-store/</a><br /></p></blockquote>
<br />
Thanks for valuable resource, but I need somewhat different result.<br />
I want to have a predefined expression in section of Binding connection properties.<br />
On developer machines and deployed this file will have the same relative path, but different contents. <br />
This will allow much more easily to deploy reports.<br />
I want to pass only connection profile name to my reports.<br />
<br />
Taras0 -
Taras,
If you put the connection profile in your specified resource folder, you can do the following in your beforeOpen script:
if( !reportContext.getHttpServletRequest().getAttribute("attributeBean").isDesigner() ){
var myresourcefolder = reportContext.getDesignHandle().getResourceFolder()
this.setExtensionProperty("OdaConnProfileStorePath", myresourcefolder+"/profilestore.dat");
}Warning No formatter is installed for the format ipb0 -
Hi,<br />
<br />
I work together with Taras on reports.<br />
I can say that solution with script beforeOpen works, but..<br />
<br />
In two words about reports structure:<br />
We have "common" library where all basic elements are stored. All reports use the same datasource.<br />
As suggested, we added a script beforeOpen to the datasource in lib:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
if( !reportContext.getHttpServletRequest().getAttribute("attributeBean").isDesigner() ){
var myresourcefolder = reportContext.getDesignHandle().getResourceFolder();
this.setExtensionProperty("OdaConnProfileStorePath", myresourcefolder+"/profilestore.dat");
}
</pre>
<br />
This code implemented needed functionality, but created a side effect.<br />
<br />
When editing dataset in report I got error:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
A BIRT exception occurred.
Plug-in Provider:Eclipse.org
Plug-in Name:BIRT Data Engine
Plug-in ID:org.eclipse.birt.data
Version:2.6.1.v20100915
Error Code:data.engine.BirtException
Error Message:A BIRT exception occurred: Error evaluating Javascript expression. Script engine error: TypeError: Cannot call method "getAttribute" of null (#1)
Script source: , line: 0, text:
__bm_beforeOpen(). See next exception for more information.
Error evaluating Javascript expression. Script engine error: TypeError: Cannot call method "getAttribute" of null (#1)
Script source: , line: 0, text:
__bm_beforeOpen()
</pre>
<br />
I tried to solve it adding some validation to the code:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
var request = reportContext.getHttpServletRequest();
if (request != null) {
if (!request.getAttribute("attributeBean").isDesigner()) {
var myresourcefolder = reportContext.getDesignHandle().getResourceFolder();
this.setExtensionProperty("OdaConnProfileStorePath", myresourcefolder+"/profilestore.xml");
}
}
</pre>
<br />
It solved problem on the report level, but when I'm trying to create or edit dataset in the library is throws new error:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
A BIRT exception occurred.
Plug-in Provider:Eclipse.org
Plug-in Name:BIRT Data Engine
Plug-in ID:org.eclipse.birt.data
Version:2.6.1.v20100915
Error Code:data.engine.BirtException
Error Message:A BIRT exception occurred: Error evaluating Javascript expression. Script engine error: Wrapped org.eclipse.birt.report.data.adapter.api.AdapterException: ReportContext method [getHttpServletRequest] can only be used in runtime. (#1)
Script source: , line: 0, text:
__bm_beforeOpen(). See next exception for more information.
Error evaluating Javascript expression. Script engine error: Wrapped org.eclipse.birt.report.data.adapter.api.AdapterException: ReportContext method [getHttpServletRequest] can only be used in runtime. (#1)
Script source: , line: 0, text:
__bm_beforeOpen()
</pre>
<br />
Anyhow it makes impossible to work with dataset after it is saved. <br />
On the other hand solution to add that script after all changes are made is not the best one.<br />
Could you please advise how to keep the script inside the lib and to avoid this error?<br />
<br />
--<br />
Regards,<br />
<br />
Andriy SenyshynWarning No formatter is installed for the format ipb0 -
I've managed to solve design-time errors when editing dataset in eclipse.<br />
<br />
Investigation showed that design-time error is displayed when<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
reportContext.getClass().getName() == "org.eclipse.birt.report.data.adapter.api.script.ReportContextObject"
</pre>
<br />
Adding additional check elimitates these errors:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
// Packages.java.lang.System.out.println("---- reportContext class name ----");
// Packages.java.lang.System.out.println(reportContext.getClass().getName());
// Packages.java.lang.System.out.println("
END
");
// OK - "org.eclipse.birt.report.engine.script.internal.ReportContextImpl"
// FAIL - "org.eclipse.birt.report.data.adapter.api.script.ReportContextObject"
if(reportContext.getClass().getName() != "org.eclipse.birt.report.data.adapter.api.script.ReportContextObject")
{
// check if reportContext contains HttpServletRequest
if (reportContext.getAppContext().containsKey('BIRT_VIEWER_HTTPSERVET_REQUEST')) {
var request = reportContext.getHttpServletRequest();
// check if request is valid
if (request != null) {
if (!request.getAttribute("attributeBean").isDesigner()) {
var myresourcefolder = reportContext.getDesignHandle().getResourceFolder();
this.setExtensionProperty("OdaConnProfileStorePath", myresourcefolder+"/profilestore.xml");
this.setExtensionProperty("OdaConnProfileName", params["rpStrConnProfile"].value);
}
}
}
}
</pre>0 -
<p>Dear William,</p>
<p> </p>
<p> I am stucked with one issue for long time and i am unable to find a solution. I am using data profiling to get the data base connection string. When i hard code the path in the report and deploy it in server its works fine. But this is not the right way. So i have placed the Database conncetion file in root and trying to call from the report , I am unable to get the file reading from the report. Its printing the location correctly . Below command I am using </p>
<p> </p>
<div>this.setExtensionProperty("odaDriverClass","com.ibm.db2.jcc.DB2Driver")</div>
<div>this.setExtensionProperty("OdaConnProfileName","DBConfig")</div>
<div>this.setExtensionProperty("OdaConnProfileStorePath",reportContext.getAppContext().get("birt.viewer.resource.path")+"\\DBConfig")</div>
<div> </div>
<div>But my report is coming in blank.</div>
<div> </div>
<div>PLease find the error log as below</div>
<div> </div>
<div>
<div> org.eclipse.birt.data.engine.odaconsumer.ConnectionManager openConnection</div>
<div>SEVERE: Unable to open connection.</div>
<div>org.eclipse.birt.report.data.oda.jdbc.JDBCException: Missing properties in Connection.open(Properties). ;</div>
<div> org.eclipse.datatools.connectivity.oda.OdaException: Unable to find or access the named profile (DBConfig) in profile store path (D:\IBM\WebSphere\AppServer\profiles\AppSrv09\installedApps\EINSAPPDEV01Cell01\birt.ear\birt.war\DBConfig).</div>
<div>at org.eclipse.birt.report.data.oda.jdbc.Connection.open(Connection.java:160).</div>
<div> </div>
<div>Config file is given full access and still its not working. PLease some one from community help me...</div>
<div> </div>
</div>0 -
<p>Hi ,</p>
<p> </p>
<p> The above issue has been resolved , Might be helpful for someone , the "<span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">OdaConnProfileName</span>" should not be the file name it should the name of the datasource, which i was not aware ,changed it its working like champ!!!</p>
<p> </p>
<p>Is there any example for externalization of webservice? I am hardcoding the webservice address every time for UAT and Prod. Please help.</p>
<p> </p>
<p> </p>
<p>Thank you</p>
0
Categories
- All Categories
- 108 Developer Announcements
- 49 Articles
- 100 General Questions
- 122 IM Services
- 40 OpenText Hackathon
- 31 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 897 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 120 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management