Home
Analytics
Connection profile store location
KavithaD
Dear friends,
I am designing reports on Windows and for development purpose we are just using
Run --> View Report ->In WebWiewer/PDF for testing.For each report we are creating data source with db connection.When we changed db for production.Now I have to change in all my reports to modify the connection information in them.
So hard coding connection info in rptdesign file seems to be bad idea and I want to change this by the way.So I created Connection profile XML and using this file in data source Connection Profile.
In my rptdesign file, XML source shows
<data-sources>
<oda-data-source extensionID="org.eclipse.birt.report.data.oda.jdbc.dbprofile" name="SiteMonVisitsDS" id="2178">
<list-property name="privateDriverProperties">
<ex-property>
<name>org.eclipse.datatools.connectivity.oda.profile.db.provider.id</name>
<value>org.eclipse.datatools.enablement.oracle.connectionProfile</value>
</ex-property>
</list-property>
<property name="OdaConnProfileName">New Oracle(0)</property>
<property name="OdaConnProfileStorePath">D:\workspace\reports\WebContent\Oracle_Profile</property>
</oda-data-source>
</data-sources>
how to change OdaConnProfileStorePath to relative path?
While googling i got something like The Javascript expression can refer to a BIRT config[] variable. For
example,
config[ "birt.viewer.working.path" ] + "../../data/myData.csv" .When i gave this script in data source --> property binding --> connection profile store url.I got some error like ,
+ Error evaluating Javascript expression. Script engine error: birt.viewer.resource.path not found
Script source: <inline>, line: 0, text:
config[ "birt.viewer.resource.path" ] + "/Oracle_Profile"
Please Provide me steps what should I do to be able to use this file by my reports? Please Help me i am in crucial stage.
Thanks,
Kavitha
Find more posts tagged with
Comments
KavithaD
Please can any one provide me a solution
KavithaD
No Solution ???? :blink:
mwilliams
Hi Kavitha,
Sorry for the delay. It sounds like the best solution might have been to create your dataSource in a library. This way, when you had to change the db from your test db to the production db, you could have changed the information in just one spot and it would have filtered down to the reports. As for how to make the path in your connection profile, you might just try starting the path with a '/' to signify that it's a relative path. I don't know if this will solve your issue. I'll have to look into that. Will you not know the absolute path to where you will have the viewer deployed?
KavithaD
Michael,
creating dataSource in a library and changing in one place is OK.But Changing datasource every time is not a good idea.Instead can we give one relative path of a file where db details is stored so that data source will take db details from that file?
You had mention something like this ,
"As for how to make the path in your connection profile, you might just try starting the path with a '/' to signify that it's a relative path."
I didn't get this?
"Will you not know the absolute path to where you will have the viewer deployed?"
How will i get know where viewer is deployed?
Thank you,
Kavitha
mwilliams
By starting with a '/', I meant doing something like:
<property name="OdaConnProfileStorePath">/relativePathToFile</property>
Maybe BIRT will just recognize that it's a relative path. I haven't done it, so I don't know. If that doesn't work, I'll look into whether there's a way to grab the path to the viewer.
KavithaD
It will be more helpful if you provide me a sample.
KavithaD
Can i create dynamic data source and set Property from the property file will this resolves my problem?
how to create dynamic data source and set Properties from property file?
In report intialization script i am doing something like this i dont know whether i am doing correctly or not,I just want to create dynamic datasource let me the dataset creation be standalone.
importPackage(Packages.org.eclipse.birt.report.model.api.ElementFactory);
importPackage(Packages.org.eclipse.birt.report.model.api.OdaDataSourceHandle);
importPackage(Packages.java.util.Properties);
importPackage(Packages.java.io);
report = reportContext.getDesignHandle();
designFactory = designHandle.getElementFactory();
dsHandle = designFactory.newOdaDataSource(
"Data Source", "org.eclipse.birt.report.data.oda.jdbc" );
property = new Properties();
property.load(new FileInputStream(reportContext.getDesignHandle().getResourceFolder()+"/Oracle_Profile"));
dsHandle.setProperty( "odaDriverClass",property.getValue("odaDriverClass"));
dsHandle.setProperty( "odaURL", property.getValue("odaURL"));
dsHandle.setProperty( "odaUser", property.getValue("odaUser"));
dsHandle.setProperty( "odaPassword", property.getValue("odaPassword"));
designHandle.getDataSources( ).add( dsHandle );
Please help me.
Thank you,
Kavitha
NBstrat
I noticed allot of posts within the forums regarding the use of profile store connections and the need for relative paths for moving from a development environment to a production/test server environment and previously had the same issues. This is from my notes regarding the configuration we use at this location so profile store connections can be 'hot-swapped' based on the value of a report parameter, so adjust accordingly to fit your particular installation/needs.
Shane
Live/Production Reporting Server
Windows 2003 server
Tomcat 6 configured with IIS
---
A typical development environment will consist of the BIRT report designer on the developer's local machine, while the production environment will consist of the BIRT runtime configured to run under Tomcat.
The Connection Profile Store URL specified in the report can be an absolute path, but to maintain flexibility and eliminate all the report files potentially needing a change because of some minor directory structure change, the path used should be a relative path. The relative path will be from the root of the Tomcat installation to the file for the Profile Store.
i.e.
-- path to the profile store
d:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\birt-viewer\connection.xml
-- relative path specified in the report.
<structure>
<property name="name">OdaConnProfileStorePath</property>
<property name="id">7</property>
<expression name="value" type="constant">.\webapps\birt-viewer\connection.xml</expression>
</structure>
When in development, the Profile Store can be used by on the development machine by creating a directory structure within the BIRT development directories that mimic the path that will be used when the report is ran on production/live server environments. This will allow a developer to create a working Profile Store using development user credentials/database servers, etc without needing additional report scripting to handle the dev versus production environments or require the developer to make post development changes to move the report from the dev machine to the live machine.
-- path to BIRT development on my local machine
C:\Users\<me>\Documents\BIRT\birt-rcp-report-designer-2_6_1\birt-rcp-report-designer-2_6_1\
-- create a 'dummy' folder structure in the BIRT dev structure that mimics the Tomcat directories
-- and copy the connection.xml (or a developer version) into the 'dummy' directory structure.
C:\Users\<me>\Documents\BIRT\birt-rcp-report-designer-2_6_1\birt-rcp-report-designer-2_6_1\webapps\birt-viewer
The directory C:\Users\<me>\Documents\BIRT\birt-rcp-report-designer-2_6_1\birt-rcp-report-designer-2_6_1 is essentially the Tomcat root when developing in the BIRT report designer.
mwilliams
Hi NBstrat,<br />
<br />
This would be a great post for the devShare. There are many less entries to search through there than in the forums. You'd also be entered in the <a class='bbc_url' href='
http://www.birt-exchange.org/org/wiki/index.php?title=DevShare_Contributor_of_the_Month_Contest'>devShare
contributor of the month</a> contest. Thanks!
NBstrat
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="71241" data-time="1291993659" data-date="10 December 2010 - 08:07 AM"><p>
Hi NBstrat,<br />
<br />
This would be a great post for the devShare. There are many less entries to search through there than in the forums. You'd also be entered in the <a class='bbc_url' href='
http://www.birt-exchange.org/org/wiki/index.php?title=DevShare_Contributor_of_the_Month_Contest'>devShare
contributor of the month</a> contest. Thanks!
<br /></p></blockquote>
<br />
<br />
Thanks Michael,<br />
<br />
I was not aware of the devShare, but have posted the same info there.<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.org/org/devshare/deploying-birt-reports/1298-development-to-live-server-using-connection-profiles/'>http://www.birt-exchange.org/org/devshare/deploying-birt-reports/1298-development-to-live-server-using-connection-profiles/</a>
;