JSP Crystal Reports XI JNDI

Luke Eason
Luke Eason used Ask the Experts™
on
Hi,

I am trying to display crystal  reports  in a jsp (Java ee) web portal . I don't have much experience with Crystall reports however I've installed Crystal Reports plugin for eclipse from the following link. We are using-
eclipse plugin:  http://downloads.businessobjects.com/akdlm/crystalreportsforeclipse/2_0/update_site/
Crystal reports XI,  
Database:DB2  i5/0S (AS/400),
the web project I want reports to display is on tomcat7
We also have a websphere dedicated to crystal reports.

Open in new window


Just for sake of testing, I went to eclipse > new > Crystal Reports Web Project. It created the project  and  few sample rpt files (screen shot attached).

I added a report that we created and tried to run the jsp file and I got following error:

Error finding JNDI name (DBCON)  

DBCON is the name of the ODBC connection we created while creating the report in crystal report professional (software).  

Any effort to help will be more than appreciated. Thank you






<%@ page contentType="text/html; charset=UTF-8" pageEncoding="ISO-8859-1" %>
<%@ taglib uri="/crystal-tags-reportviewer.tld" prefix="crviewer" %>

<crviewer:viewer reportSourceType="reportingComponent" viewerName="CrystalReport1-viewer" reportSourceVar="CrystalReport1" isOwnPage="true">
	<crviewer:report reportName="MYREPORT.rpt" />
</crviewer:viewer>

Open in new window

crystal.PNG
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
I'm not too familiar with BO, but I have a feeling that in this case, in a Java-based environment, you should be using JDBC connectivity, not ODBC. Just a guess - you may need to configure a JNDI datasource in Tomcat with the same name.
Luke EasonDBA /Developer

Author

Commented:
Thanks for the response  Mustaccio.

Yes I understand that I am suppose to use JDBC/JNDI. I know how JDBC works. I have never configured JNDI datasource before, if you can help me with that, it will be great.
Start here: http://tomcat.apache.org/tomcat-7.0-doc/jndi-datasource-examples-howto.html

You will need to download the DB2 JDBC driver package from here: https://www-304.ibm.com/support/docview.wss?uid=swg27016878

The .jar files to add to the Tomcat CLASSPATH are db2jcc.jar and db2jcc_license_cisuz.jar. The driver class name is com.ibm.db2.jcc.DB2Driver. The URL format would be jdbc:db2//hostname:port/databasename
11/26 Forrester Webinar: Savings for Enterprise

How can your organization benefit from savings just by replacing your legacy backup solutions with Acronis' #CyberProtection? Join Forrester's Joe Branca and Ryan Davis from Acronis live as they explain how you can too.

Luke EasonDBA /Developer

Author

Commented:
I already have jdbc drivers and all that. I have worked with JDBC stuff... just JNDI is new to me.  Thanks for the quick response. I will have give it a shot and let you know.

Thanks once again.
Luke EasonDBA /Developer

Author

Commented:
Mustaccio,  tell me if I understand this right.

Setting up JNDI data source is just configuring context.xml file in META-INF folder and adding jar files (drivers) in tomcat ? Is that all?

No, that is not all. As indicated in the Tomcat documentation (see the link in my previous post and also this: http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html#JDBC_Data_Sources), you will need to:
- install the driver jar files;
- declare the resource in web.xml;
- describe the resource configuration in context.xml;

Then you can use that resource reference in your report.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial