I've read in Getting Started with the Java Reporting Component (JRC) (a technical white paper in businessobjects.com) to connect through JDBC/JNDI to a report that accesses an ODBC or OLE DB data source, provided that you have created a JNDI data source with the same name as the ODBC or OLE DB data source.

I created a report using Crystal Report 10. The sample_db.rpt that I created connects to mtccsDSN ODBC datasource. The report works well whenever I preview it in the Crystal Reports Designer. Then I created a JNDI data source in the web.xml of my web application - the JNDI data source is also mtccsDSN. It should work fine but I encountered a problem loading the report in my web application through a jsp page accessing Crystal Reports 10 Java Reporting Component. The error displayed is "CrystalReportViewer - String index out of range: -1". Pls. help. Thanks in advance!

In my web application, I added the datasource by adding these lines of code in web.xml ...

<!--env-entry-value>com.mysql.jdbc.Driver!jdbc:mysql://lst_sql/mtccs? user=mtccsuser1&password=mtccsuser1;</env-entry-value-->

and my viewreport.jsp contains the ff. lines of code:

<%@ page import="com.crystaldecisions.report.web.viewer.*, com.crystaldecisions.sdk.occa.report.data.*" %>
<%@ page import="com.crystaldecisions.reports.reportenginei nterface.JPEReportSourceFactory" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.repor tsource.IReportSourceFactory2" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.repor tsource.IReportSource" %>

String report = "sample_db.rpt";

IReportSourceFactory2 rptSrcFactory = new JPEReportSourceFactory();
IReportSource reportSource = (IReportSource) rptSrcFactory.createReportSource(report, request.getLocale());

ConnectionInfos connInfos = new ConnectionInfos();
IConnectionInfo connInfo1 = new ConnectionInfo();

CrystalReportViewer viewer = new CrystalReportViewer();

viewer.processHttpRequest(request, response, getServletConfig().getServletContext(), out);