Uderc programming article aggregator sites

Unable to load database connector - using JRC w/report connecting to Oracle

Tags:
Answers: Have 4 answers
Advertisement
A simple Java program was created to test a Crystal Report using JRC. The Java program is a thick-client Swing desktop application (modified from an example of crxi_r2_migrating_rdc_to_jrc.pdf). The program failed to execute the report with the following error:
Unable to load database connector u2018com.crystaldecisions.reports.queryengine.driverImpl.DriverLoader'
It might be something simple to correct the problem, but I am not able to find related answers in the documentation and from the forum.
CR version is XI R2. The Java program was compiled and run using jdk1.4.2_13. Oracle is 10.2.
Do I have to use JDBC? or the CR Oracle driver will do? What needs to be setup? If I use JDBC, what do I need to setup (I tried to following the links in the forums or other documentation, but most of the links to http://support.businessobjects.com/.... are broken - i.e. re-route to the SAP support page but not directly linked to the articles)
When the report JRCTestReport.rpt was saved with the option "Save Data With Report", it works fine. So the problem is only with Oracle database driver, the other jars are fine.
In the report JRCTestReport.rpt the database properties are:
       DatabaseDLL             crdb_oralce.dll
       Password
       Server                        myTestDB
       Trusted_Connection    False
       User ID                      MyUser
The crdb_oracle.dll is located at:
C:\Program Files\Business Objects\Common\3.5\bin
Files are stored in the following tree structure:
<Testing Folder>
     JRCTest.java
     JRCTest.class
     WEB-INF
               lib
                    All required JRC jars and CRConfig.xml
     Reports
               JRCTestReport.rpt
Java source code JRCTest.java
import java.awt.*;
import javax.swing.*;
import java.io.*;
import com.crystaldecisions.ReportViewer.*;
// Use this for talking to JRC in-process
import com.crystaldecisions.reports.sdk.*;
import com.crystaldecisions.sdk.occa.report.reportsource.*;
public class JRCTest
     private static void createAndShowGUI()
          try
               //Make sure we have nice window decorations.
               JFrame.setDefaultLookAndFeelDecorated(false);
               //Create and set up the window.
               JFrame frame = new JFrame("JRCTest");
               frame.setTitle("JRCTest");
               frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
               ReportViewerBean viewer = new ReportViewerBean();
                                  System.out.println("ReportViewerBean.init");
               viewer.init(new String[0], null, null, null);
                                  System.out.println("new ReportClientDocument");
               ReportClientDocument rpt = new ReportClientDocument();
                                  try
                                          System.out.println("Openning Report...");
                                          rpt.open("JRCTestReport.rpt", 0);
                                  catch (Exception ex)
                                          System.out.println("Failed to open report");
                                          System.out.println(ex.toString());
                                          return;
                                  try
                                          System.out.println("logon...");
                                          rpt.getDatabaseController().logon("myUser", "myPass");
                                  catch (Exception ex)
                                          System.out.println("Failed to logon");
                                          System.out.println(ex.toString());
                                          return;
                                  System.out.println("ReportClientDocument.getReportSource");
               IReportSource rptSource = rpt.getReportSource();
               viewer.setReportSource(rptSource);
                                                System.out.println("viewer.setReportSource");
               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();
Execution result:
C:\tmp\CrystalJavaTest>java -classpath .;./WEB-INF/lib;./WEB-INF/lib/ReportViewe
r.jar;./WEB-INF/lib/jrcerom.jar;./WEB-INF/lib/jrcadapter.jar;./WEB-INF/lib/Concu
rrent.jar;./WEB-INF/lib/CrystalCharting.jar;./WEB-INF/lib/CrystalCommon.jar;./WE
B-INF/lib/CrystalContentModels.jar;./WEB-INF/lib/CrystalExporters.jar;./WEB-INF/
lib/CrystalExportingBase.jar;./WEB-INF/lib/CrystalFormulas.jar;./WEB-INF/lib/Cry
stalQueryEngine.jar;./WEB-INF/lib/CrystalReportEngine.jar;./WEB-INF/lib/CrystalR
eportingCommon.jar;./WEB-INF/lib/icu4j.jar;./WEB-INF/lib/keycodeDecoder.jar;./WE
B-INF/lib/log4j.jar;./WEB-INF/lib/MetafileRenderer.jar;./WEB-INF/lib/rasapp.jar;
./WEB-INF/lib/rascore.jar;./WEB-INF/lib/rpoifs.jar;./WEB-INF/lib/Serialization.j
ar;./WEB-INF/lib/URIUtil.jar;./WEB-INF/lib/xercesImpl.jar;./WEB-INF/lib/xml-apis
.jar JRCTest
Starting
Crystal Report Viewer 2.1.21.2
java.vendor = Sun Microsystems Inc.
java.version = 1.4.2_13
os.name = Windows XP
os.version = 5.1
os.arch = x86
ReportViewerBean.init
new ReportClientDocument
Openning Report...
logon...
ReportClientDocument.getReportSource
viewer.setReportSource
ERROR - JRCAgent1 detected an exception: Unable to load database connector 'com.
crystaldecisions.reports.queryengine.driverImpl.DriverLoader'.
        at com.crystaldecisions.sdk.occa.report.lib.ReportSDKException.throwRepo
rtSDKException(Unknown Source)
        at com.businessobjects.reports.sdk.b.i.if(Unknown Source)
        at com.businessobjects.reports.sdk.b.i.a(Unknown Source)
        at com.businessobjects.reports.sdk.b.i.byte(Unknown Source)
        at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unkno
wn Source)
        at com.crystaldecisions.proxy.remoteagent.y.a(Unknown Source)
        at com.crystaldecisions.proxy.remoteagent.r.a(Unknown Source)
        at com.crystaldecisions.sdk.occa.report.application.cf.a(Unknown Source)
        at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unkno
wn Source)
        at com.crystaldecisions.sdk.occa.report.application.ReportSource.getPage
(Unknown Source)
        at com.crystaldecisions.sdk.occa.report.application.AdvancedReportSource
.getPage(Unknown Source)
        at com.crystaldecisions.sdk.occa.report.application.NonDCPAdvancedReport
Source.getPage(Unknown Source)
        at com.businessobjects.crystalreports.viewer.core.rs.b.if(Unknown Source
        at com.businessobjects.crystalreports.viewer.core.av.a(Unknown Source)
        at com.businessobjects.crystalreports.viewer.core.av.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:534)
Unable to load database connector 'com.crystaldecisions.reports.queryengine.driv
erImpl.DriverLoader'.
Advertisement
The best answer: After I switched the report to use JDBC, I am still getting the same error.
Machine has multiple jdk, oracle 10g, Oracle11g client installed though. So I need to set my path to use the jdk from Crystal Report and Oracle 10g.
The program was compiled and ran with the following path and CLASSPATH:
set path="C:\Program Files\Business Objects\j2sdk1.4.2_08\bin";"C:\Program Files\Business Objects\j2sdk1.4.2_08\jre\bin";"C:\Program Files\Business Objects\j2sdk1.4.2_08\jre\bin\client";c:\oracle\ora102\bin
set CLASSPATH=.;./WEB-INF/lib;./WEB-INF/lib/ReportViewer.jar;./WEB-INF/lib/jrcerom.jar;./WEB-INF/lib/jrcadapter.jar;./WEB-INF/lib/Concurrent.jar;./WEB-INF/lib/CrystalCharting.jar;./WEB-INF/lib/CrystalCommon.jar;./WEB-INF/lib/CrystalContentModels.jar;./WEB-INF/lib/CrystalExporters.jar;./WEB-INF/lib/CrystalExportingBase.jar;./WEB-INF/lib/CrystalFormulas.jar;./WEB-INF/lib/CrystalQueryEngine.jar;./WEB-INF/lib/CrystalReportEngine.jar;./WEB-INF/lib/CrystalReportingCommon.jar;./WEB-INF/lib/icu4j.jar;./WEB-INF/lib/keycodeDecoder.jar;./WEB-INF/lib/log4j.jar;./WEB-INF/lib/MetafileRenderer.jar;./WEB-INF/lib/rasapp.jar;./WEB-INF/lib/rascore.jar;./WEB-INF/lib/rpoifs.jar;./WEB-INF/lib/Serialization.jar;./WEB-INF/lib/URIUtil.jar;./WEB-INF/lib/xercesImpl.jar;./WEB-INF/lib/xml-apis.jar;C:/oracle/ora102/jdbc/lib/ojdbc14.jar
I modified my java testing program to display more info:
Modified program:
import java.awt.*;
import javax.swing.*;
import java.io.*;
import com.crystaldecisions.ReportViewer.*;
// Use this for talking to JRC in-process
import com.crystaldecisions.reports.sdk.*;
import com.crystaldecisions.sdk.occa.report.reportsource.*;
import com.crystaldecisions.sdk.occa.report.exportoptions.*;
import com.crystaldecisions.sdk.occa.report.data.*;
import com.crystaldecisions.sdk.occa.report.lib.PropertyBag;
import com.crystaldecisions.sdk.occa.report.lib.IStrings;
public class JRCTest2
   private static void createAndShowGUI()
      try
         System.out.println("Starting");
         //Make sure we have nice window decorations.
         JFrame.setDefaultLookAndFeelDecorated(false);
         //Create and set up the window.
         JFrame frame = new JFrame("JRCTest2");
         frame.setTitle("Testing 1, 2, 3");
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         System.out.println("new ReportViewerBean");
         ReportViewerBean viewer = new ReportViewerBean();
         System.out.println("ReportViewerBean.init");
         viewer.init(new String[0], null, null, null);
         System.out.println("new ReportClientDocument");
         ReportClientDocument rpt = new ReportClientDocument();
         try
             System.out.println("Openning Report...");
             rpt.open("JRCTestReport.rpt", 0);
         catch (Exception ex)
            System.out.println("Failed to open report");
            System.out.println(ex.toString());
            return;
         try
            // try logon here to see if any exceptions
            rpt.getDatabaseController().logon("myUser", "myPass");
         catch (Exception ex)
            System.out.println("Failed to logon");
            System.out.println(ex.toString());
            return;
         IDatabase idb = rpt.getDatabaseController().getDatabase();
         Tables dtb = idb.getTables();
         IConnectionInfo conInfo = dtb.getTable(0).getConnectionInfo();
         PropertyBag attrs = conInfo.getAttributes();
         conInfo.setPassword("myPass");
         conInfo.setUserName("myUser");
         IStrings s = attrs.getPropertyIDs();
         for (int i=0; i < s.size(); i++)
            System.out.println(s.getString(i));
            System.out.println(attrs.getStringValue(s.getString(i)));
         System.out.println(" ");
         conInfo.setAttributes(attrs);
         attrs = conInfo.getAttributes();
         s = attrs.getPropertyIDs();
         // Print property again after setting attributes
         for (int i=0; i < s.size(); i++)
           System.out.println(s.getString(i));
           System.out.println(attrs.getStringValue(s.getString(i)));
         System.out.println(" ");
         System.out.println("ReportClientDocument.getReportSource");
         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)
      System.out.println("main");
      javax.swing.SwingUtilities.invokeLater(new Runnable()
         public void run()
            createAndShowGUI();
Running result:
C:\tmp\CrystalJavaTest>java JRCTest2
main
Starting
new ReportViewerBean
Crystal Report Viewer 2.1.21.2
java.vendor = Sun Microsystems Inc.
java.version = 1.4.2_13
os.name = Windows XP
os.version = 5.1
os.arch = x86
ReportViewerBean.init
new ReportClientDocument
Openning Report...
Trusted_Connection
false
Server Name
dbHost
Connection String
Use JDBC=b(true);Connection URL=s(jdbc:oracle:thin:@dbHost:1521:myDB);Database Class Name=s(oracle.jdbc.OracleDriver);Server=s(dbHost);User ID=s(myUser);Password=;Trusted_Connection=b(false);JDBC Connection String=s(!oracle.jdbc.OracleDriver!jdbc:oracle:thin:/@dbHost:1521:myDB)
Server Type
JDBC (JNDI)
Database Class Name
oracle.jdbc.OracleDriver
Use JDBC
true
URI
!oracle.jdbc.OracleDriver!jdbc:oracle:thin:/@dbHost:1521:myDB
Database DLL
crdb_jdbc.dll
Trusted_Connection
false
Server Name
dbHost
Connection String
Use JDBC=b(true);Connection URL=s(jdbc:oracle:thin:@dbHost:1521:myDB);Database Class Name=s(oracle.jdbc.OracleDriver);Server=s(dbHost);User ID=s(myUser);Password=;Trusted_Connection=b(false);JDBC Connection String=s(!oracle.jdbc.OracleDriver!jdbc:oracle:thin:/@dbHost:1521:myDB)
Server Type
JDBC (JNDI)
Database Class Name
oracle.jdbc.OracleDriver
Use JDBC
true
URI
!oracle.jdbc.OracleDriver!jdbc:oracle:thin:/@dbHost:1521:myDB
Database DLL
crdb_jdbc.dll
ReportClientDocument.getReportSource
ERROR - JRCAgent1 detected an exception: Unable to load database connector 'com.crystaldecisions.reports.queryengine.driverImpl.DriverLoader'.
        at com.crystaldecisions.sdk.occa.report.lib.ReportSDKException.throwReportSDKException(Unknown Source)
        at com.businessobjects.reports.sdk.b.i.if(Unknown Source)
        at com.businessobjects.reports.sdk.b.i.a(Unknown Source)
        at com.businessobjects.reports.sdk.b.i.byte(Unknown Source)
        at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
        at com.crystaldecisions.proxy.remoteagent.y.a(Unknown Source)
        at com.crystaldecisions.proxy.remoteagent.r.a(Unknown Source)
        at com.crystaldecisions.sdk.occa.report.application.cf.a(Unknown Source)
        at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
        at com.crystaldecisions.sdk.occa.report.application.ReportSource.getPage(Unknown Source)
        at com.crystaldecisions.sdk.occa.report.application.AdvancedReportSource.getPage(Unknown Source)
        at com.crystaldecisions.sdk.occa.report.application.NonDCPAdvancedReportSource.getPage(Unknown Source)
        at com.businessobjects.crystalreports.viewer.core.rs.b.if(Unknown Source)
        at com.businessobjects.crystalreports.viewer.core.av.a(Unknown Source)
        at com.businessobjects.crystalreports.viewer.core.av.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:534)
Unable to load database connector 'com.crystaldecisions.reports.queryengine.driverImpl.DriverLoader'.
Also got similar error when the path and classpath was switched to Oracle 11g.
Is there a way to tell which file that it failed to load?
Thanks
Kin