Connection profile store location [message #554420] |
Mon, 23 August 2010 01:15  |
Eclipse User |
|
|
|
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="SampleDS" id="2178">
<list-property name="privateDriverProperties">
<ex-property>
<name> org.eclipse.datatools.connectivity.oda.profile.db.provider.i d </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
[Updated on: Mon, 23 August 2010 01:17] by Moderator
|
|
|
Re: Connection profile store location [message #554594 is a reply to message #554420] |
Mon, 23 August 2010 12:06   |
Eclipse User |
|
|
|
You can set the location also in the beforeOpen script of the dataset like:
this.setExtensionProperty("OdaConnProfileStorePath",
"c:/work/styles/mysqlclassic.txt");
To make it relative use a combination of these scripts:
var rp =
reportContext.getHttpServletRequest().getSession().getServle tContext().getRealPath( "/MyConnectionProfiles");
if( rp != null ){
this.setExtensionProperty("OdaConnProfileStorePath",rp);
}
You can get an init parameter like:
var mrp =
reportContext.getHttpServletRequest().getSession().getServle tContext().getInitParameter( "BIRT_RESOURCE_PATH");
Jason
On 8/23/2010 1:15 AM, Kavitha wrote:
> 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.i d
> </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
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Connection profile store location [message #556962 is a reply to message #554420] |
Fri, 03 September 2010 07:29   |
Eclipse User |
|
|
|
Hi,
I don't know why its not working for me or i am doing some thing wrong.
Come to dynamic data source creation,
I have created a JDBC data source & given default development db and in the report beforeFactory i given like,
importPackage(Packages.java.util.Properties);
importPackage(Packages.java.io);
ds = reportContext.getDesignHandle().getDesign().findDataSource("Data Source");
property = new Properties();
property.load(new FileInputStream(reportContext.getDesignHandle().getResourceF older()+ "/Oracle_Profile"));
ds.setProperty( "odaDriverClass",property.getValue("odaDriverClass"));
ds.setProperty( "odaURL", property.getValue("odaURL"));
ds.setProperty( "odaUser", property.getValue("odaUser"));
ds.setProperty( "odaPassword", property.getValue("odaPassword"));
reportContext.getDesignHandle().getDesign().add(ds);
In while running report at run time i am reading from property file which has different db property.I am getting exceptions like below,
org.eclipse.birt.report.engine.api.EngineException: There are errors evaluating script "importPackage(Packages.java.util.Properties); importPackage(Packages.java.io); ds = reportContext.getDesignHandle().getDesign().findDataSource("Data Source"); property = new Properties(); property.load(new FileInputStream(reportContext.getDesignHandle().getResourceF older()+ "/Oracle_Profile")); ds.setProperty( "odaDriverClass",property.getValue("odaDriverClass")); ds.setProperty( "odaURL", property.getValue("odaURL")); ds.setProperty( "odaUser", property.getValue("odaUser")); ds.setProperty( "odaPassword", property.getValue("odaPassword")); ": Function importPackage must be called with a package; had "[JavaClass java.util.Properties]" instead. (/report/method[@name="beforeFactory"]#1)
what could be the problem??????
Thank you,
Kavitha
|
|
|
Re: Connection profile store location [message #557015 is a reply to message #556962] |
Fri, 03 September 2010 11:25   |
Eclipse User |
|
|
|
This line:
importPackage(Packages.java.util.Properties);
should be
importPackage(Packages.java.util);
Jason
On 9/3/2010 7:29 AM, Kavitha wrote:
> Hi,
> I don't know why its not working for me or i am doing some thing wrong.
> Come to dynamic data source creation,
>
> I have created a JDBC data source & given default development db and in
> the report beforeFactory i given like,
>
> importPackage(Packages.java.util.Properties);
> importPackage(Packages.java.io);
> ds = reportContext.getDesignHandle().getDesign().findDataSource("Data
> Source");
> property = new Properties();
> property.load(new
> FileInputStream(reportContext.getDesignHandle().getResourceF older()+
> "/Oracle_Profile"));
> ds.setProperty( "odaDriverClass",property.getValue("odaDriverClass"));
> ds.setProperty( "odaURL", property.getValue("odaURL"));
> ds.setProperty( "odaUser", property.getValue("odaUser"));
> ds.setProperty( "odaPassword", property.getValue("odaPassword"));
> reportContext.getDesignHandle().getDesign().add(ds);
>
> In while running report at run time i am reading from property file
> which has different db property.I am getting exceptions like below,
>
> org.eclipse.birt.report.engine.api.EngineException: There are errors
> evaluating script "importPackage(Packages.java.util.Properties);
> importPackage(Packages.java.io); ds =
> reportContext.getDesignHandle().getDesign().findDataSource("Data
> Source"); property = new Properties(); property.load(new
> FileInputStream(reportContext.getDesignHandle().getResourceF older()+
> "/Oracle_Profile")); ds.setProperty(
> "odaDriverClass",property.getValue("odaDriverClass")); ds.setProperty(
> "odaURL", property.getValue("odaURL")); ds.setProperty( "odaUser",
> property.getValue("odaUser")); ds.setProperty( "odaPassword",
> property.getValue("odaPassword")); ": Function importPackage must be
> called with a package; had "[JavaClass java.util.Properties]" instead.
> (/report/method[@name="beforeFactory"]#1)
>
> what could be the problem??????
>
> Thank you,
> Kavitha
>
|
|
|
|
Re: Connection profile store location [message #557460 is a reply to message #557201] |
Tue, 07 September 2010 09:54  |
Eclipse User |
|
|
|
I did not see where you set the
OdaConnProfileStorePath property in your script.
Jason
On 9/6/2010 12:56 AM, Kavitha wrote:
> Hi Jason,
>
> I am getting some exception like below,
>
> org.eclipse.birt.report.engine.api.EngineException: An exception
> occurred during processing. Please see the following message for
> details: Cannot open the connection for the driver:
> org.eclipse.birt.report.data.oda.jdbc.
> org.eclipse.birt.report.data.oda.jdbc.JDBCException: Missing properties
> in Connection.open(Properties).
>
> What could be the problem?
> I created data source and i am using dev mode connections. before
> factory method of design i am reading connections from property file for
> production mode connections.
>
> i have added one table and while executing i am getting above exception.
|
|
|
Powered by
FUDForum. Page generated in 0.07715 seconds