Hi,
This is Rajesh, I am using Crystal Reports XI with PSReportFactory. when i am exporting a report into PDF, i am getting
ReportSDKLogonException: Information is needed before this report can be processed - 2147217393 Error code name:dbLogonFailed Exception...
My Code is:-
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 only i am getting 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....