Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to open .rpt file in java

Status
Not open for further replies.

topphodu

Programmer
Aug 4, 2011
4
US
Hi,

I want to open a .rpt which is local on my drive using java. The BO server is on another machine. We have crystal enterprise 2008 edition and i have all the jars. I tried these lines of code:

Code:
import com.crystaldecisions.sdk.occa.report.application.ReportClientDocument;
import com.crystaldecisions.sdk.occa.report.lib.ReportSDKException;

		ReportClientDocument rcd = new ReportClientDocument();
		
		try {
			//rcd.setReportAppServer("DWBIXXI4");
			rcd.open("rassdk://C:/MyReport.rpt", 0);
		} catch (ReportSDKException e) {
			e.printStackTrace();
		}

The problem is, when i run this code, it says specify a report app server. And when i specify the ReportAppServer, it gives a "unable to connect" exception. Now i don't want that. I have the rpt file locally with me and i would like to open it without going to RAS server. Please help. Is there any other class which does this job?
 
Try using the ReportDocument class instead of ReportClientDocument.

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
Hi, Thanks for the reply.

I already tried ReportDocument class, but it does not have any load() method in it. Can you tell which method of it to invoke for loading .rpt files.
 
I'm not sure about the Java version of the class - the .NET version does have a Load() method. I don't have my SDK documentation links on this computer, but I'll check tonight from my laptop and let you know what I find.

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
What version of the SDK are you using?

A computer only does what you actually told it to do - not what you thought you told it to do.
 
i have crystal enterprise 2008 version and the sdk's are the one which came with the installations. i guess they are version 12
 
Hi all,

Thanks for your support. I was able to solve the problem. I downloaded the Crystal Reports for Eclipse 2.0, used those jars, and then it worked.

Basically what I learnt is - from crystal enterprise 2008 edition jar's we cannot open local .rpt files kept on appserver. It can open .rpt files if they are kept at RAS crystal server, and for that we need to pass server auth credentials. Where as from the jars that we get in eclipse plugin, we can open .rpt files kept locally on app server, and by passing the database credentials (it expects JNDI name), it can also refresh the report from server.

Both version of the jars use same class name with same package declaration: com.crystaldecisions.sdk.occa.report.application.ReportClientDocument;
but the functionality differ.

Please feel free to ask if anyone needs more info.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top