Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Export a Report to PDF Post Reply Post New Topic
Author Message
rajeshkottakota
Newbie
Newbie


Joined: 11 Nov 2007
Location: India
Online Status: Offline
Posts: 5
Quote rajeshkottakota Replybullet Topic: Export a Report to PDF
    Posted: 16 Dec 2007 at 10:07pm

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....
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.