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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to pass password and userid to report (with jdbc connection)

Status
Not open for further replies.

ulliM

Programmer
Apr 4, 2006
10
DE
Hi all,
I use the Crystal Reports XI Server installation to publish my *.rpt files.
These rpt files use a JDBC Connection to ORACLE.

I have a java swing application which server uses the RAS SDK and connects to the RAS for parameterizing the reports and producing PDFs, which are sent back to the client.
The report is published via the web management console and I'm able to start and view the report over the web.

I'm not using the ReportClientDocument, cause I won't use a servlet, just java classes.

So, how can i pass the password an userid for the database logon without using the ReportClientDocument or ReportExportControl????

>>I'm using the interface IReportSource to call .export().
The exception when calling export() method on an IReportSource instance is:

com.crystaldecisions.sdk.occa.report.lib.ReportSDKParameterFieldException: Information is needed before this report can be processed[/color red]

plz don't suggest using the JRC, due to layout differences, it's not suitable for this case

100 points for the solution :)

code snippet for the curious
Code:
String str = "Select * From CI_INFOOBJECTS WHERE SI_ID='463'";
IInfoObjects infoObjects = iStore.query(str);

IInfoObject io = (IInfoObject) infoObjects.get(0);
			
setPropertiesToInfoObject(io);


IReportSourceFactory psReportSourceFactory = (IReportSourceFactory) session
		.getService("PSReportFactory");
IReportSource reportSource = psReportSourceFactory.openReportSource(io,
		Locale.ENGLISH);
			
setDatabaseLogonInfo(reportSource, infoObjects, io);

RequestContext reqCon = new RequestContext();
ExportOptions exportOptions = new ExportOptions();
exportOptions.setExportFormatType(ReportExportFormat.PDF);
			
InputStream is = reportSource.export(exportOptions, reqCon);
[COLOR=red]com.crystaldecisions.sdk.occa.report.lib.ReportSDKParameterFieldException: Information is needed before this report can be processed[/color red]
 
Check out ConnectionInfo and ReportExportControl classes

something like:
Code:
ConnectionInfo dbLogonInfo = new ConnectionInfo();
  dbLogonInfo.setUserName("foo");
  dbLogonInfo.setPassword("bar");
	    	
ConnectionInfos dbLogonInfos = new ConnectionInfos();
  dbLogonInfos.add(dbLogonInfo);
			
ReportExportControl exportControl = new ReportExportControl();
  exportControl.setReportSource(reportSource);
[COLOR=red yellow]  exportControl.setDatabaseLogonInfos(dbLogonInfos); [/color]
  exportControl.processHttpRequest(request, response, getServletConfig().getServletContext(), null);
  exportControl.dispose();

Kingfisher
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top