Hi,
This is Rajesh, i am using Crystal Report XI with PSReportFactory... when i am exporting a report to PDF, i am getting the exception, ie
ReportSDKLogonException: Information is needed before this report can be processed.---- Error code: 2147217393 Error code ame:dbLogonFailed.
my code:-
ISessionMgr iSessionMgr = CrystalEnterprise.getSessionMgr();
//Logon to Enterprise
IEnterpriseSession iEnterpriseSession = iSessionMgr.logon(username, password, cmsname, authType);
//Retrieve the InfoStore object from the Enterprise Session
IInfoStore oInfoStore = (IInfoStore)iEnterpriseSession.getService("", "InfoStore");
//Retrieve the report from the Enterprise System
String query = "Select * From CI_INFOOBJECTS Where SI_NAME = '"+REPORT_NAME+"'";
IInfoObjects oInfoObjects = oInfoStore.query(query);
IInfoObject oReport = (IInfoObject)oInfoObjects.get(0);
IReport report = (IReport)oReport;
IReportSourceFactory2 psReportSourceFactory = (IReportSourceFactory2) iEnterpriseSession.getService("","PSReportFactory");
Object reportSource = psReportSourceFactory.createReportSource(oReport,Locale.ENGLISH);
Debug.println("checking the DBCredentials.............");
ConnectionInfos connInfos = new ConnectionInfos();
IConnectionInfo connInfo1 = new ConnectionInfo();
connInfo1.setUserName(dbUserName);
connInfo1.setPassword(dbPassword);
//add the IConnectionInfo object into the ConnectionInfo collection
connInfos.add(connInfo1);
// get the query id, the time in milliseconds
long queryID = System.currentTimeMillis();
String queryId = Long.toString(queryID);
Debug.println("adding the parameters to arraylist");
ArrayList parameters = new ArrayList();
parameters.add(queryId);
parameters.add(str_Rpt_InvoiceNo);
parameters.add(str_Rpt_CompanyID);
Debug.println("Setting to ....ExportControl...");
exportControl.setReportSource(reportSource);
//exportControl.setEnableLogonPrompt(false);
exportControl.setParameterFields(setParameters(report,parameters));
exportControl.setDatabaseLogonInfos(connInfos);
//exportControl.setEnableParameterPrompt(false);
RequestContext reqCon = new RequestContext();
reqCon.getReportStateInfo();
reqCon.getSubreportRequestContext();
ExportOptions exportOptions = new ExportOptions();
exportOptions.setExportFormatType(ReportExportFormat.PDF);
Debug.println("converting into bytes........");
//here i am getting the exception....
ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream)((IReportSource) reportSource).export(exportOptions, reqCon);
rptDetails = new ARChopsDAO(companyId.longValue()).getJRptName(str_InvoiceNo);
str_Rpt_fileName = rptDetails[1];
str_fileDesciption = rptDetails[2];
//Write file to disk...
String EXPORT_OUTPUT = EXPORT_LOC + str_Rpt_fileName;
Debug.println("Destination....."+EXPORT_OUTPUT);
writeToFileSystem(byteArrayInputStream, EXPORT_OUTPUT);
exportControl.dispose();
please help me......
Edited by rajeshkottakota - 16 Dec 2007 at 10:16pm