Crystal report from JSP using the JRC

Advertisement

Hi, I am trying to call crystal report from JSP using the JRC.
But i am getting the Error as 'Logon Failed'. my web.xml entry is
<env-entry>
<env-entry-name>jdbc/Test</env-entry-name>
<env-entry-value>!oracle.jdbc.driver.OracleDriver!jdbc:oracle:thin:{userid}/{password}@//10.0.0.1:1521/TestDB</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
i am setting the userid and password in the code. Please see the below code for your reference. Please help me to solve the issue.
<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ page import="com.crystaldecisions.report.web.viewer.CrystalReportViewer"%>
<%@ page import="com.crystaldecisions.sdk.occa.report.data.*"%>
<%@ page import="com.crystaldecisions.reports.reportengineinterface.JPEReportSourceFactory" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.reportsource.IReportSourceFactory2" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.reportsource.IReportSource" %>
<%@ page import="com.crystaldecisions.reports.reportengineinterface.JPEReportSource" %>
<html>
<head>
<title>Crystal Report with Database Logon information</title> </head>
<body bgcolor="#ffffff">
<%
try
String report = "/TEMPLATE.rpt";
IReportSourceFactory2 rptSrcFactory = new JPEReportSourceFactory();
JPEReportSource reportSource = (JPEReportSource) rptSrcFactory.createReportSource(report, request.getLocale());
CrystalReportViewer viewer = new CrystalReportViewer();
viewer.setReportSource(reportSource);
viewer.setHasRefreshButton(true);
IConnectionInfo newConnInfo = new ConnectionInfo();
newConnInfo.setUserName("TEST");
newConnInfo.setPassword("TEST");
ConnectionInfos newConnInfos = new ConnectionInfos();
newConnInfos.add(newConnInfo);
viewer.setDatabaseLogonInfos(newConnInfos);
viewer.setEnableLogonPrompt(false);
viewer.setOwnPage(true);
viewer.setOwnForm(true);
out.println("Connection Information: "+viewer.getDatabaseLogonInfos().getConnectionInfo(0).getAttributes().toString());
viewer.processHttpRequest(request, response, getServletConfig().getServletContext(),null);
viewer.dispose();
catch(Exception e)
throw new JspException( e);
%>
</body>
</html>

Advertisement

I never really had much luck with this approach.
Mind you I was using Crystal Reports 10, and as far as I recall it didn't allow setting/changing of database at this level.
Things to check
- can you create a database connection on your page with this URL/username/password?
- what server are you using? Tomcat? WebLogic?
I found this in your other post:
Connection Information: {Server Name=ee6rpt, Connection String=DSN=s(ee6rpt);User ID=s(ee62test);Password=;UseDSNProperties=b(false), Database Name=, Database DLL=crdb_odbc.dll}That would indicate it is using odbc to connect to the database (crdb_odbc.dll). ODBC is a bad idea with java.
The way I have got it to work for me (after much trial and error) was to in Crystal Reports to connect using the Oracle Driver, and specifying a tnsname - eg define REPORT_DS in tnsnames.ora.
When running through the JRC, it looked for a JNDI datasource under that same name "REPORT_DS".
Don't know if that will help you or not.
Good luck,
evnafets

October 11, 2015

Crystal report from JSP using the JRC

Hi, I am trying to call crystal report from JSP using the JRC. But i am getting the Error as 'Logon Failed'. my web.xml entry is <env-entry> <env-entry-name>jdbc/Test</env-entry-name> <env-entry-value>!oracle.jdbc.driver.OracleDriv

Open a crystal report from WAD with passing  the variables values

Hi, I need to know is there any way to link SAP WAD to crystal reports (open a crystal report from WAD)and pass the values of the variables which are entered in the Web App. (e.g. Customer id,year) should be passed to the Crystal Report. Maybe we nee

How to delete all the crystal reports from SAP B1 ?

Dear Experts, I have one problem and I need to Delete all the Crystal PLD's and Crystal Reports from SAP B1. I can delete a PLD or Report using delete option from Report and layout manager or layout designer. But I need to select delete option for ea

How to invoke crystal reports from Oracle forms 11g R2 along with passing p

How to invoke crystal reports from Oracle forms 11g R2 along with passing parameter to it. how to pass parameters to crystal report, please help.how to pass parameters to crystal report, please help.This would entirely depend on crystal reports and y

Calling Crystal Reports from Oracle Forms 10G

Hi everyone, I am trying to call a crystal report from Oracle Forms 10G. I have a button on my Form which when clicked calls a Crystal Report which the uaser then wants to save as a PDf file. Can someone please send me the code to do this and also th

How do I open a Crystal Report from Microsoft Access?

I'm looking for step-by-step instructions on how to launch a Crystal Report from a Microsoft Access application (for a dummy like me). My Crystal Report uses a connection to the Access database as the data. I have Microsoft Access 2002 with Microsoft

Problem opening Crystal Report from SAP GUI through VPN

Hi Everyone,   I am facing an issue with opening the crystal report from SAP BW Role menu(SAP GUI). The issue is only with the BW Users who are connecting to the Client systems through VPN. All the settings are done perfectly in the Transaction /CRYS

Printing Crystal Reports from UDO form

Dear Experts, I want to open a Crystal report from an addon. I've already found [the following thread|http://forums.sdn.sap.com/thread.jspa?threadID=2039424&start=0&tstart=0] and the [mentioned blog post|http://www.sdn.sap.com/irj/scn/weblogs?blog

Crystal Reports and Viewer using Parameters

I am using Crystal Reports 2008 to create a simple purchase order report from our Sap system. I have created a parameter that is a static date value for people to enter when they launch the report. When I  refresh the data in Crystal Reports 2008 I r

Can't view Crystal Reports from BW

Hi, I'm installing SAP Integration Kit XI 3.1 SP3 with IIS.  I am able to publish reports from BW to BOE but not able view them from BW.  I followed the documentation to use report/report_view.aspx to define the viewer application in Content Administ

CALL a report from WDA using SUBMIT to sap-spool

Hi, I need to call a report from one of the methods of a WDA application. The out of this report is a sapscript. I want show it in WDA (PDF). The report is called when a user clicks EXECUTE button. The piece of the code is:   call function 'GET_PRINT

How Can I call Crystal report from R3?

Hi experts,   How Can I call Crystal report from R3?Hi Bill, Can you please be specific and could you please provide the steps Thank youRead other 5 answers

Duplicate Object Name Error When Publishing Crystal Reports from BW to BOE

Hi, We recently upgraded our systems (all client and server) to SP2.7 in order to solve a problem with saving Crystal Reports to BW.  Now we are experiencing a new error when trying to publish a Crystal Report from BW to BOE (either all in one step f

Show Crystal Report (from BW) in SAP EP

Hi Everybody, I am trying to show a Crystal Report in the SAP enterprise Portal. The Report resides in BW, so I do not want to go through BOE or OpenDocument command. All threads I found on SDN relate to showing a crystal report from the BOE in the S

When I try to burn a CD off of my MacBook Air (from iTunes) using the external CD drive, it acts like it is burning the CD, but then when I try to play it the CD is blank.

When I try to burn a CD off of my MacBook Air (from iTunes) using the external CD drive, it acts like it is burning the CD, but then when I try to play it the CD is blank.Many thanks for the diagnostics. Failed while scanning for CD / DVD drives, err

How to open Crystal Reports from Business Content Ext BW

Hi friends, I have activated 0CR_FIAA_M20_Q0007 Crystal Reports from Business Content Ext BW and I have configurated BW_Publisher services in BW but I do´t see reports in /CRYSTAL/RPTADMIN. I check RFC connection and it´s ok Here I can´t get a role a

Crystal report from MSC taking long time for the first time

Hello Friends, I have a report designed in Crystal Reports to display the BP details. It is giving some performance issues. In the analysis it is found that it is taking long time immediately after i restart the machine. From the next time it is not

Using the JRC, RTF embedded in Crystal while exporting to PDF

Are there enough acronyms for ya?  I donu2019t think so either.  I am wondering if anyone else has experienced the problem I am facing and what fix, if any, did they find.  I have RTF data stored in the database I am trying to read into a report.  I

Cannot display the Crystal Report from BW..very Urgent

Hello Friends, We are executing the Crystal report XI report from BW 3.50 but cannot displaying andgiving the error messgae as follows.... <b>Service cannot be Reached</b> <b>What has happened? URL http://sapprodbw.company.com:8112/sap/b

Problem in printing Crystal Report from SAP Business One - the printing cut in it width margins

Hi i'm trying to print crystal report layout from sap b1. when i preview the report as pdf file, i have the option to choose Fit in size option and then the layout print O.k with out any margins that been cut. The problem start when i'm trying to pri