Extract/Display SQL from crystal report - java

Problem:
I have a crystal report file on a computer. I need to know how the crystal report queries a database.
Background:
The crystal report file was created 10+ years ago by a highly paid contractor. No one knows anything about how it was created. We do not have any crystal report authoring software. We don't have any information related to the crystal report file, just the report file.
Question:
If I have a crystal report file here: /file/path/to/myMagicReport.rpt, how can I extract the SQL string used to query the database from the file?
Ideally I would not like to install any software, just extract the information programatically.

I don't think there is a way to programatically extract the SQL query. Unfortunately you will have to either have somebody do it for you or install a version of Crystal Reports.
There is a free trial for Crystal Reports available from SAP here. I would download it, open the report. You can find the SQL query under the Database tab. Please see screenshot.
EDIT:
There is also rpt inspector, which will allow you to get the SQL query. They have a free trial as well here. It may give you all the info you need but probably won't let you make any changes to the report layout, if that's something you had in mind.

Related

Error generating charts in crystal report viewer from java

I have designed a report using crystal reports v14.1. The report contains some bar charts which are generated using data from MySQL database. All works well when I am previewing the report in the designer..
But when I am opening the same report in crystal report viewer from my program I am getting this error:
com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: com/businessobjects/visualization/pfjgraphics/PFJSummaryInfo---- Error code:-2147467259 Error code name:failed
All my other reports are working fine. This is the first report containing charts. I have found same question on various websites but no solution to the error, particularly solution in java. Any help is appreciated!
Found the solution.
Please update your Libraries to include the missing jar file.
Latest version of JRC can be found at the below link
For more info:
https://archive.sap.com/documents/docs/DOC-29757
Direct download link for JRC v12.2.220:
http://downloads.businessobjects.com/akdlm/crystalreportsforeclipse/2_0/crjava-runtime_12.2.220.zip

add a dynamic resultSet in Crystal Reports in eclipse

My problem is this. I have Crystal Reports with Java in Eclipse, and I was unable to connect to a database using a JDBC connector IBM but graphically. But now I want to connect to the report by code, to pass data database, and can not find how to do it. Since Crystal Reports for Java does not allow me to use a ResultSet as a data source to generate the report dynamically.
Thanks

JasperServer Error - Unable to get next record

I have a very simple report that runs perfectly on in iReports (4.5.0) on my workstation. When I upload it JasperServer CE (4.5.0) I get the following error.
1 - Unable to get next record.
java.lang.Exception: 1 - Unable to get next record.
at com.jaspersoft.ireport.jasperserver.ws.WSClient.runReport(WSClient.java:403)
at com.jaspersoft.ireport.jasperserver.ws.WSClient.runReport(WSClient.java:320)
at com.jaspersoft.ireport.jasperserver.ReportRunner.run(ReportRunner.java:70)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)
There are other much more complex queries and reports that are running on the JasperServer without problem. The database system is Basis/Pro5 running BBJ (Business Basic Java). I am connected to the database in iReports and JasperServer using the same native JDBC Basis driver (BBjJDBS.jar). JasperServer is running on the same RHEL box as the BBj database. Jasper server is installed as a bundle using both the built in DB and Tomcat. No other known conflicts exist.
The following single table query is designed to get the sum totals of a transaction for a given month. The report has one detail section which just prints the query output.
SELECT
Month(INHI.TRANSACTION_DATE) AS TransMonth,
admin.INHI.ITEM_ID,
admin.INHI.TRANSACTION_TYPE,
SUM(admin.INHI.TRANS_QUANTITY) as TransQty
FROM
admin.INHI
WHERE
admin.INHI.ITEM_ID = 'R-CBSH-3300'
AND (
admin.INHI.TRANSACTION_TYPE = 'B2'
OR admin.INHI.TRANSACTION_TYPE = 'P1')
AND admin.INHI.TRANSACTION_DATE BETWEEN '2012-01-01' AND '2012-03-31'
GROUP BY
Month(INHI.TRANSACTION_DATE),
admin.INHI.ITEM_ID,
admin.INHI.TRANSACTION_TYPE
Order By
admin.INHI.TRANSACTION_TYPE
I have looked all over to try and find additional trouble shooting tips and have ran out of options to try. Any guidance is greatly appreciated.
In my case I was able to get an extended error from the JasperServer web interface which lead me to an Date/Time issue. The crux of the whole problem was the "Order By" clause. Once I removed the order by the query worked fine.
You can also get this error if you pass a closed result set as the data source for the report.
In my case I passed the JasperReportBuilder object around and somewhere I (prematurely) closed the Connection object that the result set was bound to.

How can I generate reports containing charts with Pentaho and Java?

We have a Java EE based web application and we want to integrate Pentaho reporting API into this application.
So, I'm trying to learn how Pentaho can automatically generate reports containing charts. I have downloaded Pentaho BI server and played with it for a few days. But I'm still clueless about the following issues:
How to generate reports dynamically at runtime without loading those *.prpt files.
Where I can get a simple tutorial about dynamic report generation
What the difference is between Community Dashboard Framework, charting tools and reporting tools.
The documentation on the Community Dashboard Framework site is not properly organized, and there is not a single tutorial about getting started.
If anyone can help me find the answers to some of my questions, it will be great!
You can define reports purely via the API of the reporting engine. Samrat is right on that the preferred way of defining reports is the report designer - as code changes are harder to maintain than changes of a GUI-editable external report definition.
I think the best way to go forward is to grab Will Gorman's book about "Pentaho Reporting 3.5 for Java Developers" which gives you a deep insight into the inner workings of the reporting engine and also how to define reports dynamically.
CDF vs Reporting: CDF is a javascript toolkit for creating interactive dashboards. Dashboards are aimed to provide a high-level overview over the state of your company with the ability to drill down or even customize them. Reports produced by the reporting engine are predefined/"canned" reports that we expect to be run frequently to answer specific business questions. Charts components are just components that produce a given chart for dashboards based on a set of input parameters.
CDF uses reports and charts as content in dashboards.
Without prpt files there is no pentaho reporting. To achieve dynamically, run the pentaho BI server and pass the parameters to the report. Load the report in iframe.

How do I handle large resultsets in Crystal Reports using Java?

Problem Definition
I have a performance problem displaying large/huge resultset of data on a crystal report. The report takes about 4 minutes or more depending on the resultset size.
How do you handle large resultsets in Crystal Reports without a performance issue?
Environment
Crystal Reports XI
Apache WebSvr 2.X
Jboss 4.2.3
Struts
Java Reporting Component (JRC)
Crystal Report Viewer (CRV)
Firefox
Details
I use the CRXI thick client to build my report (.rpt) and then use it in my webapplication (webapp) under Jboss.
User specifies the filter criteria to generate a report (date range etc) and submits the request to the webapp. Webapp queries the database, gets a "resultset".
I initialize the JRC and CRV according to all the specifications and finally call the "processHttpRequest" method of Crystal Report Viewer to display the report on browser.
So.....
Request received to generate a report with a filter criteria
Query DB to get resultset
Initialize JRC and CRV
finally display the report by calling
reportViewer.processHttpRequest(request, response, request.getSession().getServletContext(), null);
The performance problem is within the last step. I put logs everywhere and noticed that database query doesnt take too long to return resultset. Everything processes pretty quickly till I call the processHttpRequest of CRV. This method just hangs for a long time before displaying the report on browser.
CRV runs pretty fast when the resultset is smaller, but for large resultset it takes a long long time.
I do have subreports and use Crystal report formulas on the reports. Some of them are used for grouping also. But I dont think Subreports is the real culprit here. Because I have some other reports that dont have any subreports, and they too get really slow displaying large resultsets.
Solutions?
So obviously I need a good solution to this generic problem of "How do you handle large resultsets in Crystal Reports?"
I have thought of some half baked ideas.
A) Use external pagination and fetch data only for the current page being displayed. But for this, CRXI must allow me to create my own buttons (previous, next, last), so I can control the click event and fetch data accordingly. I tried capturing events by registering event handler "addToolbarCommandEventListener" of CRV. But my listener gets invoked "after" processHttpRequest method completes, which doesnt help.
Some how I need to be able to control the UI by adding my own previous page, next page, last page buttons and controlling it's click events.
B) Have CRXI use a jquery type of functionality, to allow browser side page navigation. So maybe the first time it'll take 5 mins to display the report, but once it's displayed, user can go to any page without sending the request back to server.
C) Try using Crystal Reports 2008. I'm open to using this version, but I couldnt figureout if it has any features that can help me.
D) Use BIRT or JasperReports, since they apparently have the ability to handle large datasets, by caching a part of the dataset on disk etc...
E) Will using the Crystal Reports Servers like cache server, application server etc help in any way? I read a little on the Crystal Page Viewer, Interactive Viewer, Part Viewer etc....but I'm not sure if any of these things are going to solve the issue.
I'd appreciate it if someone can point me in the right direction.

Categories

Resources