Home
Analytics
Connection Profile
emsien
I'm using a connection profile store to hold my database information. When using it as a hardcoded location it works find but when trying to access it using a Connection Profile Store URL it fails to load the profile. The url looks like this
reportContext.getAppContext().get("birt.report.home.dir") + 'ServerProfiles.dat'
where the 'birt.report.home.dir' is defined in the java application calling the report - when I print out the variable to a data cell on the report it prints the correct location for the file so not sure why the property binding isn't working. This apporach is being used because the app deploys on both Linux and Windows and a generic location needs to be used to get the profile from.
I'm running on JBoss 4.2.3.GA using Birt 2.5.1 - attached is the actual rptdesing file being created.
Here's the error
2010-08-03 16:22:10,233 ERROR [STDERR] Aug 3, 2010 4:22:10 PM org.eclipse.datatools.connectivity.oda.profile.provider.ProfilePropertyProviderImpl getProfileStoreFile
WARNING: getProfileStoreFile( String ): java.net.MalformedURLException: unknown protocol: f
2010-08-03 16:22:10,234 ERROR [STDERR] Aug 3, 2010 4:22:10 PM org.eclipse.datatools.connectivity.oda.profile.provider.ProfilePropertyProviderImpl getProfileStoreFile
WARNING: getProfileStoreFile( Properties ): Ignoring the PROFILE_STORE_FILE_PATH_PROP_KEY value (F:\Thirdparty\eclipse projects\CV2\WebServer\src\reports\ServerProfiles.dat) in connection properties. The specified path does not exist in file system.
2010-08-03 16:22:10,826 ERROR [STDERR] Aug 3, 2010 4:22:10 PM org.eclipse.datatools.connectivity.oda.profile.provider.ProfilePropertyProviderImpl getConnectionProfile
WARNING: org.eclipse.datatools.connectivity.oda.OdaException ;
org.eclipse.core.runtime.CoreException: Error loading connection profile data.
This is from the linux box - but as you can see form the error and the location of the file is
/usr/local/jboss/esp/birt/reprots/ServerProfiles.dat but you can see its searching for the hardcoded one - hence the windows path not the Linux path
Any ides why this doesn't work?
Thanks
Merv
Find more posts tagged with
Comments
JasonW
Merv,
Can you try :
"file:///" + reportContext.getAppContext().get("birt.report.home.dir") + 'ServerProfiles.dat'
Jason
emsien
Hi Jason
No it gives me the same error. It's like its always looking at the hardcoded value and the value in the property bindings is being ignore. It isn't overriding the hardcoded value - which I assume is the design but it doesn't seem to check that value.
Mev
JasonW
I tried the following beforeOpen script with a MySql connection profile and it worked:
if( !reportContext.getHttpServletRequest().getAttribute("attributeBean").isDesigner() ){
this.setExtensionProperty("OdaConnProfileStorePath", "c:/work/styles/mysqlclassic.txt");
}
I did this with BIRT 2.5.2. Can you try this?
Jason
emsien
Hi Jason
I added the beforeOpen script
if( !reportContext.getHttpServletRequest().getAttribute("attributeBean").isDesigner() )
{
this.setExtensionProperty("OdaConnProfileStorePath", reportContext.getAppContext().get("birt.report.home.dir") + 'ServerProfiles.dat' );
}
and got an error on the getAttribute call
Data (id = 612):
+ An exception occurred during processing. Please see the following message for details:
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()
Then I changed the script to be just
this.setExtensionProperty("OdaConnProfileStorePath", reportContext.getAppContext().get("birt.report.home.dir") + 'ServerProfiles.dat' );
and it works on both Windows and Linux - not sure what the side affect is of removing the if condition and always setting the value but its working with no errors being thrown from my application so I'm good unless you think its bad doing it this way
Thanks for the help
Merv
JasonW
Merv,
That code was developed for the BIRT viewer. I just did not want it to switch the profile while in the designer. The viewer loads the servlet request into the app context. In your case you are not doing this. So you can just put the statement I posted earlier in another if like:
if( reportContext.getHttpServletRequest() != null ) { .....
Or if you do not mind it trying it in the desginer do not have the condition.
Any chance you can log a bug that the method you tried first (Property Binding) did not work?
Jason