|
Re: Check availability of datasets defined in shared library [message #673732 is a reply to message #673574] |
Tue, 24 May 2011 15:12 |
|
Tomas,
You could write an API program to run your reports or datasets and check
the errors. Are you using 2.6.1 or greater. The errors should be much
more informative. I just changed a query and picked the wrong table and
got this error:
Table (id = 9):
+ An exception occurred during processing. Please see the following
message for details:
Failed to prepare the query execution for the data set: Data Set
Failed to prepare the following query for the data set type
(org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet).
[select *
from orderdetailss
where ordernumber = 10101]
org.eclipse.birt.report.data.oda.jdbc.JDBCException: Error
preparing SQL statement.
SQL error #1: Table/View 'ORDERDETAILSS' does not exist.
;
java.sql.SQLSyntaxErrorException: Table/View 'ORDERDETAILSS' does
not exist.
exception.error ( 1 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: An
exception occurred during processing. Please see the following message
for details:
Failed to prepare the query execution for the data set: Data Set
Failed to prepare the following query for the data set type
(org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet).
[select *
from orderdetailss
where ordernumber = 10101]
org.eclipse.birt.report.data.oda.jdbc.JDBCException: Error
preparing SQL statement.
SQL error #1: Table/View 'ORDERDETAILSS' does not exist.
;
java.sql.SQLSyntaxErrorException: Table/View 'ORDERDETAILSS' does
not exist.
at
Let me know if you can use a java program to do the check and I will
write you an example.
Jason
On 5/24/2011 3:18 AM, TomasGreif wrote:
> Hi,
>
> I have around 30 datasets defined in shared rptlibrary file and around
> 60 reports based on this data. Unfortunately, all the datasets are using
> production database as a data source. Whenever the database model
> changes (at least once per month) it affects one or more datasets and
> reports. Today, it is a lot of work to go through all the datasets one
> by one to see whether the sql is still valid or not.
>
> What I would like to do is to create some kind of system report that
> checks all the datasets and returns 0/1 (Y/N) if the dataset is working
> or not. Of course the best would be if the report could add new datasets
> dynamically, so I do not have to change it always when there is new
> dataset.
>
> Unfortunately, I do not know how to achieve this. My first idea was to
> add one field from first row from every dataset to the report. However,
> when the dataset is not valid, only not really helping error message is
> returned like:
>
> The following items have errors:
>
> Data (id = 8):
> - Can not load the report query: 8. Errors occurred when generating the
> report document for the report element with ID 8.
>
>
> Is there any way how to return element name in the error (instead of
> element ID) or maybe some javascript error handling function?
>
> Any idea appreciated.
>
> Regards,
>
> Tomas
>
>
>
>
|
|
|
|
Re: Check availability of datasets defined in shared library [message #675466 is a reply to message #675323] |
Tue, 31 May 2011 15:34 |
|
Tomas,
You can use a simple program like:
package REAPI;
import java.util.Locale;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.EngineException;
import org.eclipse.birt.report.engine.api.IReportEngine;
import org.eclipse.birt.report.engine.api.IReportEngineFactory;
import org.eclipse.birt.report.engine.api.IReportRunnable;
import org.eclipse.birt.report.engine.api.IRunTask;
public class RunAndRenderTaskErrorCheck {
public void runReport() throws EngineException
{
IRunTask task=null;
IReportEngine engine=null;
EngineConfig config = null;
try{
config = new EngineConfig( );
config.setBIRTHome("C:\\birt\\birt-runtime-2_6_1\\birt-runtime-2_6_1\\ReportEngine");
Platform.startup( config );
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject(
IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
engine = factory.createReportEngine( config );
IReportRunnable design = null;
//Open the report design
design = engine.openReportDesign("Reports/badquery.rptdesign");
//Create task to run and render the report,
task = engine.createRunTask(design);
task.setLocale(new Locale("en", "US"));
task.setMaxRowsPerQuery(1);
task.run("output/resample/errorcheck.rptdocument");
}catch( Exception ex){
ex.printStackTrace();
}
finally
{
if ( !task.getErrors( ).isEmpty( ) )
{
for ( Object e : task.getErrors( ) )
{
//Check here
( (Exception) e ).printStackTrace( );
}
}
task.close();
engine.destroy();
Platform.shutdown( );
System.out.println("Finished");
}
}
/**
* @param args
*/
public static void main(String[] args) {
try
{
RunAndRenderTaskErrorCheck ex = new RunAndRenderTaskErrorCheck( );
ex.runReport();
}
catch ( Exception e )
{
e.printStackTrace();
}
}
}
Remember to just create a new task for each report you want to check as
starting up and shutting down the the platform is expensive. You could
just create a loop to create a new run task for each report.
Jason
On 5/31/2011 3:44 AM, TomasGreif wrote:
> Thank you Jason,
>
> I can ask our IT guys to run some java code - it would be really helpful
> if you can post an example.
>
> Regards,
>
> Tomas
|
|
|
Powered by
FUDForum. Page generated in 0.03209 seconds