Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Referencing .sql file, .jar file
Referencing .sql file, .jar file [message #686058] Tue, 21 June 2011 14:27 Go to next message
dizzya934 is currently offline dizzya934Friend
Messages: 7
Registered: June 2011
Junior Member
Hi,

I've designed a BIRT report which utilizes a scripted data source, which itself references an ArrayList<String[]> returned by a method in a Java class. The class gets its data from querying a database. The query is stored in a .sql file. Everything worked correctly, and the report was populated with data. But then I needed to upload my report to its desination, and I realized I'll have to also upload the SQL file (I could just hardcode it in the class but the query is quite lengthy- over 500 lines- part of the reason I'm using this convoluted method of querying the database). Here I ran into problems. The Java class itself still runs correctly, getting the data. However, the report won't run anymore. I tried including the .sql file in my JAR file, putting it in the workspace directory, etc, but when I try to preview the report I get

Error.ScriptEvaluationError ( 1 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: There are errors evaluating script ....

// (my open() script which calls a Java method)

({1}.at
......
....
...
..
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)
Caused by: org.eclipse.birt.data.engine.core.DataException: A BIRT exception occurred: Error evaluating Javascript expression. Script engine error: Wrapped java.sql.SQLException: JZ0S4: Cannot execute an empty (zero-length) query. (#3)
Script source: , line: 0, text:
__bm_OPEN(). See next exception for more information.
...
..
//more of the same

None of my scripts have changed- all I've altered is:
1)name of .sql file referenced in Java code.
2)Re-exported JAR file to reflect #1

Any ideas?


Thanks,
Daniel
Re: Referencing .sql file, .jar file [message #686077 is a reply to message #686058] Tue, 21 June 2011 15:41 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Daniel,

Can you try putting the sql file in the birt resource folder (set in web.xml) then in your javascript (beforeFactory) do this:
mysqlfile = reportContext.getResource("mysql.sql");
This should give you a file location url to the sql file. Pass this to the java class. To check the url put a data item in the report and set its expression
to
mysqlfile;

Jason
Re: Referencing .sql file, .jar file [message #686113 is a reply to message #686077] Tue, 21 June 2011 18:48 Go to previous messageGo to next message
dizzya934 is currently offline dizzya934Friend
Messages: 7
Registered: June 2011
Junior Member
Thanks Jason, that does work for the absolute path, however the report is going to be run from some server out there, so I'm trying to figure out the directory structure and all. I think I've got some leads, sparked by your javascript data display idea.

Thank you,
Daniel
Re: Referencing .sql file, .jar file [message #686635 is a reply to message #686113] Wed, 22 June 2011 16:22 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Daniel,

While this reportContext.getResource("mysql.sql"); does return an absolute path it will change depending on how it is deployed and should still work. As long as the .sql file is in the resource directory it should not matter how you deploy it.

Jason
Previous Topic:PageVariable classcast-exception after osgi-bundle-refresh
Next Topic:Script to set dates for scheduled repoorts
Goto Forum:
  


Current Time: Fri Apr 19 10:26:18 GMT 2024

Powered by FUDForum. Page generated in 0.02096 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top