Skip to Content
0
Dec 18, 2020 at 07:24 PM

Performance when changing data source for XML and XSD in CR runtime in Java

68 Views

Hi, I have reports working with Xml and Xsd. I'm generating PDF output using Crystal Reports runtime for Eclipse. The report is generated successfully but for some reason it takes a long time (almost 3 minutes) to do so.

The main culprits are establishing connection using crdb_xml.dll and validating XML schema:

20/12/18 12:09:38 INFO sdk.JRCCommunicationAdapter: received request: verifyDatabaseRequest

20/12/18 12:09:38 INFO DataEngineCommand.VerifyDatabaseCommand: Verifying database

20/12/18 12:09:38 INFO ReportCommand.CheckDatabaseCommand: CheckDatabaseCommand,0,Enter CreateCommand,<document=ReportDocument:<report=main><reportPath=C:\Test\aaover.rpt>>;

20/12/18 12:09:38 INFO ReportCommand.CheckDatabaseCommand: CheckDatabaseCommand,732118572,Exit CreateCommand,<document=ReportDocument:<report=main><reportPath=C:\Test\aaover.rpt>>;

20/12/18 12:09:38 INFO ReportCommand.CheckDatabaseCommand: CheckDatabaseCommand,732118572,Enter perform,<document=ReportDocument:<report=main><reportPath=C:\Test\aaover.rpt>>;

20/12/18 12:09:38 INFO reports.queryengine: Connection logon:Database DLL=s(crdb_xml.dll);XML DataSet Object=

20/12/18 12:09:57 INFO data.xml: Read referenced schema location from xml instance successfully.

20/12/18 12:09:57 INFO data.xml: java.io.ByteArrayInputStream@13d9261fnot in SchemaHandleHashtable, parse it.

20/12/18 12:09:57 INFO data.xml: Begin parsing the specified schema: java.io.ByteArrayInputStream@13d9261f

20/12/18 12:09:57 INFO data.xml: Begin to validate the specified schema

20/12/18 12:12:09 INFO data.xml: Begin to get all table structures from schema

This is the code:

byte[] xsdBytes = Files.readAllBytes(Paths.get("C:\\Test\\aaover.xsd"));	 
byte[] xmlBytes = Files.readAllBytes(Paths.get("C:\\Test\\aaover.xml"));

XMLDataSet xml_ds = new XMLDataSet();
xml_ds.setXMLSchema(new ByteArray(xsdBytes));
xml_ds.setXMLData(new ByteArray(xmlBytes));	
			
ReportClientDocument rpt = new ReportClientDocument();
rpt.open("C:\\Test\\aaover.rpt", 0);			
			
String tableName = rpt.getDatabaseController().getDatabase().getTables().getTable(0).getAlias();
rpt.getDatabaseController().setDataSource(xml_ds, tableName, "");

ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream)
	rpt.getPrintOutputController().export(ReportExportFormat.PDF);

rpt.close();

All files are local and very small: XML data file is just 52Kb, XSD is 2Kb.

The environment is:

Java 1.8.181

Eclipse 2019-12

crjava-runtime_12.2.207

Is there a way to make this operation perform reasonably? I'm open to any suggestions.

Thank you,

Dmitri Zaslavsky