Dying about calling Crystal Report by Java code

Hi everybody
Hi please anybody of u tell me about how can I access Crystal Report file from my java code I really need to know it badly and urgently
thanks in advance

If you type "crystal report" in the search box, click search, check the discussion forum area and click search again, you'll find a lot of discussion on this topic including where you can download the Java API. You can also just click the link below to bring up the search results:
http://search.java.sun.com/Search/java?qt=%22crystal+report%22&col=jsun0&col=jsun1&col=javafrm&rf=0
V.V.

Similar Messages

  • Call Crystal Report from java

    <p>Hi,<br /><br />Can anyone pl send me an e.g of how to call crystal reports from java ? Preferably crsytal version 10. how to instantiate a crystal report viewer? how to pass parameters? how to set the connection string?</p><p>my email is <a href="mailto:[email protected]">[email protected]</a><br /><br />Regards,</p><p>Hui Bee<br /></p>

    <p>Hi Hui Bee, </p><p>   There are a number of version 10 samples available contained in the following package:</p><p><a href="http://support.businessobjects.com/communityCS/FilesAndUpdates/cr10_jrc_samples.exe" title="JRC 10 samples">http://support.businessobjects.com/communityCS/FilesAndUpdates/cr10_jrc_samples.exe</a></p><p>However, I would strongly suggest that you take a look at using the latest version of the Java component that ships with our Crystal Reports for Eclipse product. You can download it from here:</p><p><a href="/node/450">http://diamond.businessobjects.com/node/450</a></p><p>and best of all, it&#39;s free! </p><p>Regards,<br />Sean Johnson (CR4E Product Manager) <br /><br /> <a href="http://www.eclipseplugincentral.com/Web_Links-index-req-ratelink-lid-639.html">Rate this plugin @ Eclipse Plugin Central</a>          </p>

  • VM crash when calling crystal report in java (Unix)

    We experience a serious problem when try to develop a crystal report application that run at Sun Solaris 9. Our program is to export pdf from crystal report. The program will always got VM crash when open the crystal report (but it's not 100% happened, it will always happen when we second time open the same report). I got no problem when run my program in the windows XP or another unix machine of Solaris 8. The report path is correct, but don't know why it will crash when open the report. May anyone help on it?
    Below see the system log:
    Jul  8 09:32:05 prospero genunix: [ID 269049 kern.notice] NOTICE: java[23499] at
    tempt to execute non-executable data at 0x0 by uid 65639
    Jul  8 09:33:04 prospero genunix: [ID 269049 kern.notice] NOTICE: java[23720] at
    tempt to execute non-executable data at 0x0 by uid 65639
    Jul  8 09:36:07 prospero genunix: [ID 269049 kern.notice] NOTICE: java[24335] at
    tempt to execute non-executable data at 0x0 by uid 65639
    Below see the java coding and the VM crash message:
    reportDocument = new ReportClientDocument();
    reportDocument.open(mSummaryReportName, 0); <=== always crash here
    String query = " SELECT BRCH_RPT_SUMM.NM_BRIEF_ACC, BRCH_RPT_SUMM.NM_PRAD, BRCH_RPT.DT_VAL_CURR, BRCH_RPT_SUMM.CD_ACC, BRCH_RPT_SUMM.NM_SHRT_ACC, BRCH_RPT_SUMM.IN_FUD_BRCH_WRN, BRCH_RPT_SUMM.CD_BTCH, BRCH_RPT_SUMM.ID_PRSN, BRCH_RPT_SUMM.CD_PRTR, BRCH_RPT_SUMM.IN_BRCH_SPRS " +
    "FROM COMPLIANCE.BRCH_RPT BRCH_RPT INNER JOIN COMPLIANCE.BRCH_RPT_SUMM BRCH_RPT_SUMM ON ((BRCH_RPT.CD_BTCH=BRCH_RPT_SUMM.CD_BTCH) AND (BRCH_RPT.ID_PRSN=BRCH_RPT_SUMM.ID_PRSN)) AND (BRCH_RPT.CD_PRTR=BRCH_RPT_SUMM.CD_PRTR) " +
    " WHERE BRCH_RPT_SUMM.IN_BRCH_SPRS='N' " +
    "AND BRCH_RPT.cd_btch = '" + mBtchCd + "' " +
    "and BRCH_RPT.cd_prtr = '" + mPrtrCd + "' " +
    " and BRCH_RPT.id_prsn = " + mPrsnId;
    Statement statement = mDb.getConnection().createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
    String tableAlias = reportDocument.getDatabaseController().getDatabase().getTables().getTable(0).getAlias();
    ResultSet resultSet = statement.executeQuery(query);
    reportDocument.getDatabaseController().setDataSource(resultSet, tableAlias , "resultsetTable");
    byteArrayInputStream = (ByteArrayInputStream)reportDocument.getPrintOutputController().export(ReportExportFormat.PDF);
    //Use the Java I/O libraries to write the exported content to the file system.
    byteArray = new bytehttp://byteArrayInputStream.available();
    //Create a new file that will contain the exported result.
    file = new File(mReportExportPath);
    fileOutputStream = new FileOutputStream(file);
    byteArrayOutputStream = new ByteArrayOutputStream(byteArrayInputStream.available());
    x = byteArrayInputStream.read(byteArray, 0, byteArrayInputStream.available());
    byteArrayOutputStream.write(byteArray, 0, x);
    byteArrayOutputStream.writeTo(fileOutputStream);
    statement.close();
    resultSet.close();
    byteArrayInputStream.close();
    byteArrayOutputStream.close();
    fileOutputStream.close();
    reportDocument.close();
    An unexpected error has been detected by HotSpot Virtual Machine:
    Internal Error (53484152454432554E54494D450E43505001A8 01), pid=28689, tid=1
    Java VM: Java HotSpot(TM) Server VM (1.5.0_13-b05 mixed mode)
    T H R E A D
    Current thread (0x000386f0): JavaThread "main" threadin_Java, id=1
    Stack: [0xffb7e000,0xffc00000), sp=0xffbfc690, free space=505k
    Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
    V http://libjvm.so+0x70c3c4
    V http://libjvm.so+0x4383b4
    V http://libjvm.so+0x2fbde0
    V http://libjvm.so+0x274bf4
    C http://libthread.so.1+0x15bb4
    C http://libthread.so.1+0xf80c
    C http://libthread.so.1+0xf9bc
    j java.util.HashMap.removeEntryForKey(Ljava/lang/Object;)Ljava/util/HashMap$Entry;+119
    j java.util.HashMap.remove(Ljava/lang/Object;)Ljava/lang/Object;+2
    j com.crystaldecisions.reports.reportdefinition.kv.a(Lcom/crystaldecisions/reports/queryengine/af;Lcom/crystaldecisions/reports/queryengine/af;Z)V+135
    j com.crystaldecisions.reports.reportdefinition.datainterface.g.a(Lcom/crystaldecisions/reports/queryengine/ch;Lcom/crystaldecisions/reports/queryengine/ch;ZZ)V+229
    j com.crystaldecisions.reports.reportdefinition.datainterface.g.a(Lcom/crystaldecisions/reports/queryengine/ch;Lcom/crystaldecisions/reports/queryengine/ch;ZZLcom/crystaldecisions/reports/queryengine/b/w;)V+235
    j com.crystaldecisions.reports.reportdefinition.datainterface.g.a(Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Ljava/lang/String;Lcom/crystaldecisions/reports/reportdefinition/datainterface/a;)V+682
    j com.crystaldecisions.reports.dataengine.bj.new()V+24
    j com.crystaldecisions.reports.common.as.a(Lcom/crystaldecisions/reports/common/af;)V+96
    j com.crystaldecisions.reports.common.ae.a(Lcom/crystaldecisions/reports/common/l;)V+20
    j com.businessobjects.reports.sdk.b.w.a(Lcom/crystaldecisions/reports/reportdefinition/bi;Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;)V+207
    j com.businessobjects.reports.sdk.b.w.int(Lcom/crystaldecisions/sdk/occa/report/lib/PropertyBag;Ljava/lang/String;)V+231
    j com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(IILjava/lang/String;Lcom/crystaldecisions/client/helper/ISecurityContext;Lcom/crystaldecisions/xml/serialization/IXMLSerializable;)Lcom/crystaldecisions/proxy/remoteagent/ResultInfo;+3326
    j com.crystaldecisions.proxy.remoteagent.x.a(Lcom/crystaldecisions/client/helper/ISecurityContext;Ljava/lang/String;IILcom/crystaldecisions/xml/serialization/IXMLSerializable;Lcom/crystaldecisions/proxy/remoteagent/j;)Lcom/crystaldecisions/proxy/remoteagent/ResultInfo;+70
    j com.crystaldecisions.proxy.remoteagent.q.a(IILcom/crystaldecisions/xml/serialization/IXMLSerializable;Lcom/crystaldecisions/proxy/remoteagent/j;)Lcom/crystaldecisions/proxy/remoteagent/ResultInfo;+83
    j com.crystaldecisions.sdk.occa.report.application.dd.a(IILcom/crystaldecisions/xml/serialization/IXMLSerializable;)Lcom/crystaldecisions/proxy/remoteagent/ResultInfo;+44
    j com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)V+284
    j com.crystaldecisions.sdk.occa.report.application.DatabaseController.setDataSource(Ljava/sql/ResultSet;Ljava/lang/String;Ljava/lang/String;)V+5
    j com.crystaldecisions.reports.sdk.DatabaseController.setDataSource(Ljava/sql/ResultSet;Ljava/lang/String;Ljava/lang/String;)V+7
    j com.jpmorgan.awm.jfam.ptc.reporting.AnalysisExporter.exportReport()V+157
    j com.jpmorgan.awm.jfam.ptc.reporting.EODReport.main([Ljava/lang/String;)V+744
    v ~StubRoutines::call_stub
    V http://libjvm.so+0x19b514
    V http://libjvm.so+0x2dd44c
    C java0x222c main0x1164

    According to the documentation for interpreting hotspot logs, the following can be determined from yours:
    "An unexpected error has been detected by HotSpot Virtual Machine:
    Internal Error (53484152454432554E54494D450E43505001A8 01), pid=28689, tid=1
    Java VM: Java HotSpot(TM) Server VM (1.5.0_13-b05 mixed mode)"
    When the HotSpot VM generates an internal error it is referring to a line of code in your application.  The hexidecimal string is encoding the source module and line number where the error occurs.
    "Current thread (0x000386f0): JavaThread "main" threadin_Java, id=1"
    Essentially means that the JavaThread is running interpreted or compiled code when the error occurs.
    The rest of the hotspot identifies what the thread has done up to this point.... even though to you it appears that it fails on the open method, it looks like it is actually failing after the setDataSource method call.
    I would suggest that you look at other logs, ie: application server logs, Solaris message logs, database logs to see if you can identify where things actually fall apart.  The first place to start would be the database connectivity because it appears that is the last thing that gets generated in the log file.

  • VM crash when calling crystal report in java

    =======
    REPOST
    =======
    We experience a serious problem when try to develop a crystal report application that run at Sun Solaris 10. Our program is to export pdf from crystal report. The program will always got VM crash when open the crystal report or export the crystal report (but it's not 100% happened, it will always happen when we second time open the same report). I got no problem when run my program in the windows XP. May anyone help on it?
    Below see the coding and the VM crash message:
    reportDocument = new ReportClientDocument();
    reportDocument.open(mSummaryReportName, 0);
    String query = " SELECT BRCH_RPT_SUMM.NM_BRIEF_ACC, BRCH_RPT_SUMM.NM_PRAD, BRCH_RPT.DT_VAL_CURR, BRCH_RPT_SUMM.CD_ACC, BRCH_RPT_SUMM.NM_SHRT_ACC, BRCH_RPT_SUMM.IN_FUD_BRCH_WRN, BRCH_RPT_SUMM.CD_BTCH, BRCH_RPT_SUMM.ID_PRSN, BRCH_RPT_SUMM.CD_PRTR, BRCH_RPT_SUMM.IN_BRCH_SPRS " +
    "FROM COMPLIANCE.BRCH_RPT BRCH_RPT INNER JOIN COMPLIANCE.BRCH_RPT_SUMM BRCH_RPT_SUMM ON ((BRCH_RPT.CD_BTCH=BRCH_RPT_SUMM.CD_BTCH) AND (BRCH_RPT.ID_PRSN=BRCH_RPT_SUMM.ID_PRSN)) AND (BRCH_RPT.CD_PRTR=BRCH_RPT_SUMM.CD_PRTR) " +
    " WHERE BRCH_RPT_SUMM.IN_BRCH_SPRS='N' " +
    "AND BRCH_RPT.cd_btch = '" + mBtchCd + "' " +
    "and BRCH_RPT.cd_prtr = '" + mPrtrCd + "' " +
    " and BRCH_RPT.id_prsn = " + mPrsnId;
    Statement statement = mDb.getConnection().createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
    String tableAlias = reportDocument.getDatabaseController().getDatabase().getTables().getTable(0).getAlias();
    ResultSet resultSet = statement.executeQuery(query);
    reportDocument.getDatabaseController().setDataSource(resultSet, tableAlias , "resultsetTable");
    byteArrayInputStream = (ByteArrayInputStream)reportDocument.getPrintOutputController().export(ReportExportFormat.PDF);
    //Use the Java I/O libraries to write the exported content to the file system.
    byteArray = new bytehttp://byteArrayInputStream.available();
    //Create a new file that will contain the exported result.
    file = new File(mReportExportPath);
    fileOutputStream = new FileOutputStream(file);
    byteArrayOutputStream = new ByteArrayOutputStream(byteArrayInputStream.available());
    x = byteArrayInputStream.read(byteArray, 0, byteArrayInputStream.available());
    byteArrayOutputStream.write(byteArray, 0, x);
    byteArrayOutputStream.writeTo(fileOutputStream);
    statement.close();
    resultSet.close();
    byteArrayInputStream.close();
    byteArrayOutputStream.close();
    fileOutputStream.close();
    reportDocument.close();
    An unexpected error has been detected by HotSpot Virtual Machine:
    Internal Error (53484152454432554E54494D450E43505001A8 01), pid=28689, tid=1
    Java VM: Java HotSpot(TM) Server VM (1.5.0_13-b05 mixed mode)
    T H R E A D
    Current thread (0x000386f0): JavaThread "main" threadin_Java, id=1
    Stack: [0xffb7e000,0xffc00000), sp=0xffbfc690, free space=505k
    Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
    V http://libjvm.so+0x70c3c4
    V http://libjvm.so+0x4383b4
    V http://libjvm.so+0x2fbde0
    V http://libjvm.so+0x274bf4
    C http://libthread.so.1+0x15bb4
    C http://libthread.so.1+0xf80c
    C http://libthread.so.1+0xf9bc
    j java.util.HashMap.removeEntryForKey(Ljava/lang/Object;)Ljava/util/HashMap$Entry;+119
    j java.util.HashMap.remove(Ljava/lang/Object;)Ljava/lang/Object;+2
    j com.crystaldecisions.reports.reportdefinition.kv.a(Lcom/crystaldecisions/reports/queryengine/af;Lcom/crystaldecisions/reports/queryengine/af;Z)V+135
    j com.crystaldecisions.reports.reportdefinition.datainterface.g.a(Lcom/crystaldecisions/reports/queryengine/ch;Lcom/crystaldecisions/reports/queryengine/ch;ZZ)V+229
    j com.crystaldecisions.reports.reportdefinition.datainterface.g.a(Lcom/crystaldecisions/reports/queryengine/ch;Lcom/crystaldecisions/reports/queryengine/ch;ZZLcom/crystaldecisions/reports/queryengine/b/w;)V+235
    j com.crystaldecisions.reports.reportdefinition.datainterface.g.a(Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Ljava/lang/String;Lcom/crystaldecisions/reports/reportdefinition/datainterface/a;)V+682
    j com.crystaldecisions.reports.dataengine.bj.new()V+24
    j com.crystaldecisions.reports.common.as.a(Lcom/crystaldecisions/reports/common/af;)V+96
    j com.crystaldecisions.reports.common.ae.a(Lcom/crystaldecisions/reports/common/l;)V+20
    j com.businessobjects.reports.sdk.b.w.a(Lcom/crystaldecisions/reports/reportdefinition/bi;Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;)V+207
    j com.businessobjects.reports.sdk.b.w.int(Lcom/crystaldecisions/sdk/occa/report/lib/PropertyBag;Ljava/lang/String;)V+231
    j com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(IILjava/lang/String;Lcom/crystaldecisions/client/helper/ISecurityContext;Lcom/crystaldecisions/xml/serialization/IXMLSerializable;)Lcom/crystaldecisions/proxy/remoteagent/ResultInfo;+3326
    j com.crystaldecisions.proxy.remoteagent.x.a(Lcom/crystaldecisions/client/helper/ISecurityContext;Ljava/lang/String;IILcom/crystaldecisions/xml/serialization/IXMLSerializable;Lcom/crystaldecisions/proxy/remoteagent/j;)Lcom/crystaldecisions/proxy/remoteagent/ResultInfo;+70
    j com.crystaldecisions.proxy.remoteagent.q.a(IILcom/crystaldecisions/xml/serialization/IXMLSerializable;Lcom/crystaldecisions/proxy/remoteagent/j;)Lcom/crystaldecisions/proxy/remoteagent/ResultInfo;+83
    j com.crystaldecisions.sdk.occa.report.application.dd.a(IILcom/crystaldecisions/xml/serialization/IXMLSerializable;)Lcom/crystaldecisions/proxy/remoteagent/ResultInfo;+44
    j com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)V+284
    j com.crystaldecisions.sdk.occa.report.application.DatabaseController.setDataSource(Ljava/sql/ResultSet;Ljava/lang/String;Ljava/lang/String;)V+5
    j com.crystaldecisions.reports.sdk.DatabaseController.setDataSource(Ljava/sql/ResultSet;Ljava/lang/String;Ljava/lang/String;)V+7
    j com.jpmorgan.awm.jfam.ptc.reporting.AnalysisExporter.exportReport()V+157
    j com.jpmorgan.awm.jfam.ptc.reporting.EODReport.main([Ljava/lang/String;)V+744
    v ~StubRoutines::call_stub
    V http://libjvm.so+0x19b514
    V http://libjvm.so+0x2dd44c
    C java0x222c main0x1164

    This is a problem of the VM itself. You will need to address the issue at SUN forums.

  • Java calling Crystal Report API [Error_NotEnoughRight ]

    Hi All,
    I am trying to call Crystal report's Java API in my JSP and Servlet.....The viewer as such is working fine.....But when I add a grouop to a Report it gives the Following Error... This is an example code copied from this forum....u can find that from
    http://support.businessobjects.com/library/kbase/articles/c2011829.asp
    Code Used
    ============
    //Add a group, on [Country] to the report
    Group grp = new Group();
    IField countryFld = custFields.getField(12);
    grp.setConditionField(countryFld);
    /**********Failing in the Following Line Start ***********/
    rptDoc.getDataDefController().getGroupController().add(0, grp);
    /**********Failing in the Following Line End ***********/
    Error Message
    =============
    Customer Name java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key Error_NotEnoughRight
    Print Stack Trace
    ===============
    java.util.MissingResourceException: Can't find resource for bundle java.util.Pro
    pertyResourceBundle, key Error_NotEnoughRight
    at java.util.ResourceBundle.getObject(ResourceBundle.java:314)
    at java.util.ResourceBundle.getObject(ResourceBundle.java:311)
    at java.util.ResourceBundle.getString(ResourceBundle.java:274)
    at com.crystaldecisions.client.helper.ResourceManager.getString(UnknownSource)
    at com.crystaldecisions.client.helper.SDKResourceManager.getString(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.af.try(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.GroupController.add(Unknown Source)
    at org.apache.jsp.FlexibleReport_005fTry3_jsp._jspService(FlexibleReport_005fTry3_jsp.java:138)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:184)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:833)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:732)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:619)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:688)
    at java.lang.Thread.run(Thread.java:536)
    Thanks in Advance
    Kababu

    CROSS POST
    http://forum.java.sun.com/thread.jsp?forum=53&thread=549788&start=0

  • Ask about Crystal report with java

    I have a problem. Can you help me to solve it?
    The problem is how to show a crystal report by java and struts action in html.
    Thank you and regards.

    http://www.google.co.za/search?hl=en&q=%2Bjava+%2B%22crystal+reports%22&meta=
    Gives this as the first result:
    http://www.businessobjects.com/products/reporting/crystalreports/java/default.asp
    You then search the site:
    http://www.businessobjects.com/search/?summary=1&client=www_frontend&proxystylesheet=www_frontend&output=xml_no_dtd&lr=lang_en&oe=utf8&ie=utf8&website=&ct=livewww-all&q=java
    Which leads you to this page:
    http://www.businessobjects.com/products/dev_zone/java/default.asp
    Try STFW, RTFM and implement something, then ask a specific question.

  • How to create a report with data using the Crystal Reports for Java SDK

    Hi,
    How do I create a report with data that can be displayed via the Crystal Report for Java SDK and the Viewers API?
    I am writing my own report designer, and would like to use the Crystal Runtime Engine to display my report in DHTML, PDF, and Excel formats.  I can create my own report through the following code snippet:
    ReportClientDocument boReportClientDocument = new ReportClientDocument();
    boReportClientDocument.newDocument();
    However, I cannot find a way to add data elements to the report without specifying an RPT file.  Is this possible?  I seems like it is since the Eclipse Plug In allows you to specify your database parameters when creating an RPT file.
    is there a way to do this through these packages?
    com.crystaldecisions.sdk.occa.report.data
    com.crystaldecisions.sdk.occa.report.definition
    Am I forced to create a RPT file for the different table and column structures I have? 
    Thank you in advance for any insights.
    Ted Jenney

    Hi Rameez,
    After working through the example code some more, and doing some more research, I remain unable to populate a report with my own data and view the report in a browser.  I realize this is a long post, but there are multiple errors I am receiving, and these are the seemingly essential ones that I am hitting.
    Modeling the Sample code from Create_Report_From_Scratch.zip to add a database table, using the following code:
    <%@ page import="com.crystaldecisions.sdk.occa.report.application.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.data.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.document.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.definition.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.lib.*" %>
    <%@ page import = "com.crystaldecisions.report.web.viewer.*"%>
    <%
    try { 
                ReportClientDocument rcd = new ReportClientDocument();
                rcd.newDocument();
    // Setup the DB connection
                String database_dll = "Sqlsrv32.dll";
                String db = "qa_start_2012";
                String dsn = "SQL Server";
                String userName = "sa";
                String pwd = "sa";
                // Create the DB connection
                ConnectionInfo oConnectionInfo = new ConnectionInfo();
                PropertyBag oPropertyBag1 = oConnectionInfo.getAttributes();
                // Set new table logon properties
                PropertyBag oPropertyBag2 = new PropertyBag();
                oPropertyBag2.put("DSN", dsn);
                oPropertyBag2.put("Data Source", db);
                // Set the connection info objects members
                // 1. Pass the Logon Properties to the main PropertyBag
                // 2. Set the Server Description to the new **System DSN**
                oPropertyBag1.put(PropertyBagHelper.CONNINFO_CRQE_LOGONPROPERTIES, oPropertyBag2);
                oPropertyBag1.put(PropertyBagHelper.CONNINFO_CRQE_SERVERDESCRIPTION, dsn);
                oPropertyBag1.put("Database DLL", database_dll);
                oConnectionInfo.setAttributes(oPropertyBag1);
                oConnectionInfo.setUserName(userName);
                oConnectionInfo.setPassword(pwd);
                // The Kind of connectionInfos is CRQE (Crystal Reports Query Engine).
                oConnectionInfo.setKind(ConnectionInfoKind.CRQE);
    // Add a Database table
              String tableName = "Building";
                Table oTable = new Table();
                oTable.setName(tableName);
                oTable.setConnectionInfo(oConnectionInfo);
                rcd.getDatabaseController().addTable(oTable, null);
        catch(ReportSDKException RsdkEx) {
                out.println(RsdkEx);  
        catch (Exception ex) {
              out.println(ex);  
    %>
    Throws the exception
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: java.lang.NullPointerException---- Error code:-2147467259 Error code name:failed
    There was other sample code on SDN which suggested the following - adding the table after calling table.setDataFields() as in:
              String tableName = "Building";
                String fieldname = "Building_Name";
                Table oTable = new Table();
                oTable.setName(tableName);
                oTable.setAlias(tableName);
                oTable.setQualifiedName(tableName);
                oTable.setDescription(tableName) ;
                Fields fields = new Fields();
                DBField field = new DBField();
                field.setDescription(fieldname);
                field.setHeadingText(fieldname);
                field.setName(fieldname);
                field.setType(FieldValueType.stringField);
                field.setLength(40);
                fields.add(field);
                oTable.setDataFields(fields);
                oTable.setConnectionInfo(oConnectionInfo);
                rcd.getDatabaseController().addTable(oTable, null);
    This code succeeds, but it is not clear how to add that database field to a section.  If I attempt to call the following:
    FieldObject oFieldObject = new FieldObject();
                oFieldObject.setDataSourceName(field.getFormulaForm());
                oFieldObject.setFieldValueType(field.getType());
                // Now add it to the section
                oFieldObject.setLeft(3120);
                oFieldObject.setTop(120);
                oFieldObject.setWidth(1911);
                oFieldObject.setHeight(226);
                rcd.getReportDefController().getReportObjectController().add(oFieldObject, rcd.getReportDefController().getReportDefinition().getDetailArea().getSections().getSection(0), -1);
    Then I get an error (which is not unexpected)
    com.crystaldecisions.sdk.occa.report.lib.ReportDefControllerException: The field was not found.---- Error code:-2147213283 Error code name:invalidFieldObject
    How do I add one of the table.SetDataFields()  to my report to be displayed?
    Are there any other pointers or suggestions you may have?
    Thank you

  • Avoid Printer selection Dialogue box when printing Crystal report in JAVA

    Hi i am calling crystal report in my servlet using Report Client Document SDK, now i want to print the report directly to the default printer set without selecting the printer from the select printer dialogue box. In other words want to avoid the select printer dialogue box from appearing . Can any body suggest me how do i do this .
    Any suggestions appreciated.

    In javascripting the code is
    function Print()
    if (document.all)
    WebBrowser1.ExecWB(6, -1) //use 6, 1 to prompt the print dialog or 6, 6 to omit it;
    WebBrowser1.outerHTML = "";
    <object ID="WebBrowser1" WIDTH="0" HEIGHT="0"
    CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">
    But the above code does not work in windows XP SP2.... and i cannot restrict my clients OS.
    where as C#,ASP.NET  provides the functionality to print directly to printer as
    The ReportDocument class provides PrintToPrinter method that may be used to print a CR direct to the printer. If no printer is selected, the default printer will be used to send the printing pages to.
    The PrintToPrinter method takes four parameters.
    nCopies : Indicates the number of copies to print.
    collated : Indicates whether to collate the pages.
    startPageN : Indicates the first page to print.
    endPageN : Indicates the last page to print.
    The following steps will guide you to achieve the same:
    Add crystal report (.cr) file to your ASP.NET application.
    Add a report instance on the page level.
    Dim report As MyReport = New MyReport
    Populate reports data on Page_Init 
      ' Get data in a DataSet or DataTable
            Dim ds As DataSet = GetData()
            ' Fill report with the data
         report.SetDataSource(ds)
    Print Report
    report.PrintToPrinter(1, False, 0, 0)
    If you wish to print certain page range, change last two parameters From to To page number.
    If you want to set page margins, you need to create a PageMargin object and set PrintOptions of the ReportDocument.
    The following code sets page margins and printer name:
    Dim margins As PageMargins =  Report.PrintOptions.PageMargins
       margins.bottomMargin = 200
       margins.leftMargin = 200
       margins.rightMargin = 50
       margins.topMargin = 100
       Report.PrintOptions.ApplyPageMargins(margins)
       ' Select the printer name
       Report.PrintOptions.PrinterName = printerName
    Thn Why not a java SDK for Crystal report can provide such a functionality...
    Edited by: rtabassum on Mar 25, 2010 6:34 AM
    Edited by: rtabassum on Mar 25, 2010 6:36 AM
    Edited by: rtabassum on Mar 25, 2010 6:42 AM

  • How do you reference a Formular Object on a Crystal Report using Java

    Hi all,
    I am trying to reference an object on my report which contains a Formula field.
    I have read the following 2 threads, but they refer to textObjects:
    [How do you reference a textObject on a Crystal report using Java|Re: How do you reference a textObject on a Crystal report using Java?]
    [Changing the text of ITextObject programatically|Re: Changing the text of ITextObject programatically]
    But I cannot even get those to work. I can reference a object which refers to a database field but as soon as I try
    reference a textObject or reportObject I just get a NULL variable.
    Below is the code I am useing
    IReportObject dbField = reportClientDocument.getReportDefController().findObjectByName("BOB1");
    IReportObject textBob = reportClientDocument.getReportDefController().findObjectByName("BOB2");
    "BOB1" is the name of my DB field Object, and "BOB2" can be a Text box or a Formula item and I just get nothing.
    I have just tested it with a FieldHeadingObject and that returns a valid object, so clearly I am going about this the wrong way
    for objects I place on the reports which are not driven by the database items.
    Ultimately what I want to do is reference an object in the Report Footer which will contain the RecordCount of the number of
    records contained in the report, which I am them going to use to determine if the report holds data,
    if it does I will print it, else ignore it and move on the the next report. I am doing this so that I can at an extra filter to split
    a report up into groups and produce a sinlge PDF for each group instead of one massive PDF containing all the groups.
    So if someone has a solution to any of my problems I would be very greatful, and I dont mind being told Im an idiot and should
    rather do it another way, as long as you supply that other way
    Thanks for the help
    Darren
    Edited by: Darren Jackson on Dec 16, 2009 7:29 PM
    Forgot to add am using CR4Ev2 SP3

    Right I have made some headway.
    Firstly, Im an idiot. I was making changes and setting up test fields on my report, but then when running the app, I had it looking at
    the backup report, which would explain why all the new textbox fields were not being found.
    The stupiditity did force me to delve deep and work out a fair bit of how the reports work, so cant complain too much. BUT, I am still
    not able to return values of Formula fields and formulas extra. Could someone tell me if this is even possible. I get retrieve the formula field
    name, and properties but not its value once the report has been populated. Am I wasting my time?
    Well I will continue dismantling my reports till I find the answer, or someone points me in the right direction.
    If any one is interested this is the code I used to drill down to my text boxes:
    IReportObject recCount = reportClientDocument.getReportDefController().findObjectByName("TB1");
    ITextObject obj_RecCount = (ITextObject) recCount;
    System.out.println(obj_RecCount.getName());
    Paragraphs objP = obj_RecCount.getParagraphs();
    for (int i = 0; i < objP.size(); i++){
         ParagraphElements pE = objP.getParagraph(i).getParagraphElements();
         for (int j = 0;j < pE.size(); j++){
              IParagraphTextElement pEE = (ParagraphTextElement) pE.getParagraphElement(j);
              System.out.println(pEE.getText());
    Cheers

  • JNDI error while generating pdf from crystal reports in java

    Hi, i want to generate PDF from crystal reports in java. I have the .PDF file with database configured into the report. Following details are available in report.
    1. Server Name      = testdb
    2. Database Name  = testdb
    3. User
    4. Password
    I am using CR XI.
    In CRConfig.xml i had given following details.
    <JDBC>
         <CacheRowSetSize>100</CacheRowSetSize>
         <JDBCURL>jdbc:oracle:thin:@192.218.216.102:1521://TESTDB</JDBCURL>
         <JDBCClassName>oracle.jdbc.driver.OracleDriver</JDBCClassName>
         <JDBCUserName>user</JDBCUserName>
         <JNDIURL>password</JNDIURL>
         <JNDIConnectionFactory></JNDIConnectionFactory>
         <JNDIInitContext>/</JNDIInitContext>
         <JNDIUserName>testdb</JNDIUserName>
         <GenericJDBCDriver>
              <Default>
                   <ServerType>UNKNOWN</ServerType>
                   <QuoteIdentifierOnOff>ON</QuoteIdentifierOnOff>
                   <StoredProcType>Standard</StoredProcType>
                   <LogonStyle>Standard</LogonStyle>
              </Default>
         </GenericJDBCDriver>
    </JDBC>
    When i am calling from java as standalone, i am getting following error.
    JRCAgent1 detected an exception: Error finding JNDI name (testdb)
    at com.crystaldecisions.sdk.occa.report.lib.ReportSDKException.throwReportSDKException(Unknown Source)      at com.businessobjects.reports.sdk.b.i.if(Unknown Source)
    Can anyone let me know where is the problem?

    Actually, the question boils down to; does the framework support the fonts?
    I believe that my question re. this working in the designer was valid. The designer does not use the framework, so if it works there, it is either a framework issue or a runtime print engine issue.
    I believe if you use the code below, it will list fonts available to the framework:
    foreach(FontFamily ff in FontFamily.Families)
    System.Diagnostics.Debug.WriteLine(ff.Name);
    For more information see kbase [1198306 - Crystal Report displaying incorrect font in Microsoft Visual Studio .NET|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_dev/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333133393338333333303336%7D.do]
    Ludek

  • How to Call Crystal Reports from Swing Application

    Hi All,
    I have a requirement for calling Crystal Report from Swing Application. Please let me know how can I do that, and also provide the Source code for calling the crystal report.
    Thanks in advance.
    Chandra

    hi
    this is the code that i am using in my application which is similar to urs. but i am working with CR XI so make all the neccessary changes.
        import java.awt.*;
        import javax.swing.*;
        import com.crystaldecisions.ReportViewer.*;
        import com.crystaldecisions.reports.sdk.*;
        import com.crystaldecisions.sdk.occa.report.reportsource.*;
       public class HelloSwing
            public static void createAndShowGUI()
                try
                    //Make sure we have nice window decorations.
                    JFrame.setDefaultLookAndFeelDecorated(true);
                    //Create and set up the window.
                    JFrame frame = new JFrame("HelloWorldSwing");
                    frame.setTitle( "Testing Reports");
                    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                   ReportViewerBean viewer = new ReportViewerBean();
                    viewer.init( new String[0], null, null, null);
                  ReportClientDocument rpt = new ReportClientDocument();
                    rpt.open( "report path", 1 );
                    IReportSource rptSource = rpt.getReportSource();
                    viewer.setReportSource( rptSource );
                    frame.getContentPane().add( viewer, BorderLayout.CENTER );
                    frame.setSize( 700, 500 );
                    frame.setVisible(true);
                    viewer.start();
                catch ( Exception exception )
                    System.out.println( exception.toString() );
            public static void main(String[] args)
                javax.swing.SwingUtilities.invokeLater(new Runnable()
                    public void run()
                        createAndShowGUI();
       there are 23 jar files that u need to import into ur package. but remember that ReportViewerBean should be the first jar file in the list & it should be followed by jrcerom.jar
    specify the key in the CRConfig.xml file (which also has to be imported in the package)
    u can find these jar files in the common objects folder in your program files.
    hope it helps. best of luck

  • URGENT!!! calling crystal reports from oracle forms 10g

    Is it possible to call crystal reports from oracle forms 10g?
    Can someone help to answer how, if there is a solusion, to call crystal reports from oracle forms 10g.
    Please provide codes with details showing step by step.
    Thanks

    hi
    try something like this.
    DECLARE
    charWinHandle VARCHAR2(50);
    numWinHandle NUMBER;
    BEGIN Set_Application_Property(Cursor_Style,'BUSY');
    charWinHandle := Get_Item_Property('Control.Rep',Window_Handle);
    numWinHandle := To_Number(charWinHandle);
    :Item('Control.CrystalReport1').OCX.Crystal.Crysta lReport.WindowParentHandle
    := numWinHandle;
    :Item('Control.CrystalReport1').OCX.Crystal.Crysta lReport.WindowState := 2;
    :Item('CONTROL.CRYSTALREPORT1').OCX.Crystal.Crysta lReport.Connect
    := 'DSN=;UID=' || Get_Application_Property(UserName) ||
    ';pwd=' || Get_Application_Property(password) || ';dsq=;';
    Crystal_CrystalCtrl.ReportFileName( :Item('Control.CrystalReport1').interface,
    'C:\Sample_Rep.Rpt' );
    Set_Window_Property( Forms_Mdi_Window, Window_State,Maximize );
    Set_Window_Property( 'MAIN', Window_State, Maximize );
    :reptitle := 'Report Preview Window';
    numWinHandle := Crystal_CrystalCtrl.PrintReport( :Item('Control.CrystalReport1').interface );
    Set_Application_Property(Cursor_Style,'DEFAULT');
    END;NOTE: Change the report name and path according to your required file name and path in
    the "Crystal_CrystalCtrl.ReportFileName" method call. Also, the connection string shown
    assumes that you will use the current USER and PASSWORD for the Form.
    - To make the above Form generic so that you can run any Crystal report from it, then create
    a parameter for the report name and pass it to the Form using CALL_FORM from any other Form.
    Then just replace the file name with the passed parameter.
    -. Run the Form
    If its correct/helpful please mark it thanks.
    sarah
    Edited by: S@R@h on Nov 27, 2009 6:33 AM

  • How to set DbConnections when scheduling a crystal report using Crystal Reports Server Java SDK?

    Post Author: Manjula
    CA Forum: JAVA
    Hi,
    Trying to schedule a report using Crystal Reports Server Java SDK. Want to pass DBConnections from API, though passing DBConnections, the report is not being scheduled and says "Failed to retrieve data from the database.Details:&#91;Database Vendor Code:6550&#93;.
    Would be thankful if someone could answer my point as applicable.
    Here is the code attached.
    ISDKList dbLogons = oReport.getReportLogons();int dbLogonSize = dbLogons.size();
    for(int i=0; i<dbLogonSize; ++i) {
    IReportLogon dbLogon = (IReportLogon)dbLogons.get(i);
    dbLogon.setDatabaseName("DBname");
    dbLogon.setUserName("usrname");
    dbLogon.setPassword("pwd");
    Thanks in advance.

    Post Author: Manjula
    CA Forum: JAVA
    Ted,
    Thank you for your valuable information.
    First, tried scheduling on Central Management Console and then with the java code.It worked fine, but here is another question for you.
    On the Console, a report exists with ServerName and UserName harcoded and when trying to set ServerName and UserName from the java code, its throwing exception. Where as Password is not set on Console, am able to set password from java.
    And DatabaseName is not set on Console (non editable), unable to set the same from java too. Why is it so?
    So, my question is - though ServerName,DatabaseName,UserName,Password exists on the Console report, can't I override those parameters from java?
    Would be greatful if you answer my question and provide me some guidance.
    Thanks in advance.

  • Calling Crystal report

    Dear All
    Can you please assists me with code to call Crystal reports in Abap program.
    Thank you in advance
    William

    hi,
    please see :
    http://help.sap.com/saphelp_nw04s/helpdata/en/e3/156e3fefa13042e10000000a114084/frameset.htm
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/004aacbb-4983-2b10-8da7-cdff5dcbb948
    it will help you
    regards
    rahul

  • Call Crystal Report Atom

    Hi Expert,
    I developed a scenario for Call Crystal Report.
    But when I call the crystal report it's give me below error.
    "com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: InternalFormatterException---- Error code:-2147467259 Error code name:failed"
    Thanks,
    Tushar

    Hi Tushar
    As far as I remember I had a similar problem and in my case it was due to specific font used in report definition. I did like this: first I checked if the problem persists if I use very simple report and it revealed that the problem was gone; then I started to remove parts of my report and checked if the problem shows up again. After some time I found out that one of the font was responsible - I don't know why.
    Kind regards,
    Radek

Maybe you are looking for

  • Can i get the photos on my ipod back onto my computer?

    I had a problem with my emac and lost my iphoto photos from the last year. I have them all on my ipod video. is there a way to get them back onto the emac or my new macbook?

  • Black screen/progress bar with Yosemite startup

    Since installing Yosemite on my relatively new imac, when I boot up i get a black screen with the Apple logo and a progress bar, which takes about 90 seconds to load. I've tried disc first aid, verify/repair permissions etc , done a new install from

  • Does the private browsing mode in FF3.6 use the cache from normal mode?

    While I'm in PB mode, does FF3.6 use the data from '''normal''' mode cache? The purpose of asking this Q is: I'm a web developer. I want to visit a site freshly (without any data used from cache). But I don't want to clear all my cache/cookies etc fr

  • Untrusted Forest Discovery

    Hi all, installed SCCM 2012 R2 in one domain - all seems to be functioning well. We have a second, untrusted domain which I need to deploy a DP and MP into. In order to do this I first need to use the Add Forest feature to discover the untrusted doma

  • Changing the MXML of a component at runTime

    Hi there, I need, depending on runTime conditions, to update the surface of a Flex window with a combination of controls. For example I may need to layout this line THIS IS STATIC TEXT #COMBOBOX# THIS IS ANOTHER STATIC TEXT #CHEKBOX# Or this line : #