1359257 - "com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: can not find table 'viewtest'" when changing report data source by JRC

SAP Knowledge Base Articles - public

1359257 - "com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: can not find table 'viewtest'" when changing report data source by JRC


  • Error: "com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: can not find table 'viewtest'" when changing report data source from SQL Server to Oracle database by Java Reporting Component (JRC) custom application
  • Error code:-2147467259 Error code name:failed

Reproducing the Issue

  1. Create a Crystal report (CR) based on JDBC connection to SQL Server 2000 Database.
  2. Use JRC sample code as below to change the report data source from SQL Server 2000 to Oracle 10g which has same table structure and same table name as that in SQL Server 2000.

      * Sample utility method for switching the database connection properties of all tables accessible from a databaseController
      * (i.e., could be a main report database controller, or a subreport's database controller) from one database to another.
     private static void switch_tables(DatabaseController databaseController) throws ReportSDKException {
      //Declare the new connection properties that report's datasource will be switched to.
      //NOTE: These are specific to using JDBC against a particular Oracle database.  Be sure to use the
      //DisplayConnectionInfo sample to determine what your own connection properties need to be set to.
      final String DBUSERNAME = "system";
      final String DBPASSWORD = "apple";
      final String SERVERNAME = "Oracle Server";
      final String DATABASE_NAME = "XE";
      final String CONNECTION_STRING = "Use JDBC=b(true);Connection URL=s(jdbc:oracle:thin:@"+SERVERNAME+":1521);" +
               "Database Class Name=s(oracle.jdbc.driver.OracleDriver);Server=s("+SERVERNAME+");" +
               "User ID=s("+DBUSERNAME+");Password=s("+DBPASSWORD+");Database=s("+DATABASE_NAME+");Trusted_Connection=b(false);" +
               "JDBC Connection String=s(!oracle.jdbc.driver.OracleDriver!jdbc:oracle:thin:{userid}/{password}@"+SERVERNAME+":1521:"+DATABASE_NAME+";"; 
      final String URI = "!oracle.jdbc.driver.OracleDriver!jdbc:oracle:thin:{userid}/{password}@"+SERVERNAME+":1521:"+DATABASE_NAME;
      final String DATABASE_DLL = "crdb_jdbc.dll";
      //Obtain collection of tables from this database controller.
      Tables tables = databaseController.getDatabase().getTables();

      //Set the datasource for all main report tables.
      for (int i = 0; i < tables.size(); i++) {
       ITable table = tables.getTable(i);
       //Keep existing name and alias.
       //Change properties that are different from the original datasource.
       //Change connection information properties.
       IConnectionInfo connectionInfo = table.getConnectionInfo();
       //Set new table connection property attributes.
       PropertyBag propertyBag = new PropertyBag();
       //Overwrite any existing properties with updated values.
       propertyBag.put("Trusted_Connection", "false");
       propertyBag.put("Server Name", SERVERNAME); //Optional property.
       propertyBag.put("Connection String", CONNECTION_STRING);
       propertyBag.put("Database Name", DATABASE_NAME);
       propertyBag.put("Server Type", "JDBC (JNDI)");
       propertyBag.put("URI", URI);
       propertyBag.put("Use JDBC", "true");
       propertyBag.put("Database DLL", DATABASE_DLL);
       //Set database username and password.
       //NOTE: Even if these the username and password properties don't change when switching databases, the
       //database password is *not* saved in the report and must be set at runtime if the database is secured. 
       //Update old table in the report with the new table.
       databaseController.setTableLocation(table, tables.getTable(i));   
  3. Run JRC application which includes above method switch_tables().
  4. Error message: "com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: can not find table 'viewtest'" occurred. 
  • JRC
  • CR XI R2 with SP2
  • SQL Server 2000
  • Oracle 10g


  1. The name of source table in SQL Server is lower case (for example: viewtest), but the target table in Oracle 10g is upper case (for example: VIEWTEST).
  2. When using table.setName(table.getName()) to set original table name as report's new table name and then connect to Oracle database, JDBC will not find the table name with lower case in target Oracle database.


Replace table.setName(table.getName()) with table.setName(table.getName().toUpperCase()) in method switch_tables(). It converts original table name to upper case thus the report can properly connect to the corresponding table in Oralce.


can not find table, JRC, com.crystaldecisions.sdk.occa.report.lib.ReportSDKException , KBA , emkba , bisdk , BI-DEV-JAV , BI Software Development Kits (SDKs) - Java , Problem


Crystal Reports for Java 1.0