cancel
Showing results for 
Search instead for 
Did you mean: 

Using Java Api to change the Managed Relational Connection to a database in a Crystal report

Former Member
0 Kudos

I am newer to crystal reports and I am working with your api right now and need some help understanding how it works. I am trying to change a shared connection (database connection) from dev to qa by using your java api. I am working in Crystal Enterprise BO 4.0 or 4.1.  I have tried several different ways and a couple different jar files. I am have used the ones that came with the eclipse down load and I have used the the ones that come from the Crystal enterprise down load.  I get this error when running the ones that come with the enterprise down load. Do I need to set up the server? Where do I do that if I do? this error comes when I try and open the report using the Enterprise jar files

com.crystaldecisions12.sdk.occa.report.lib.ReportSDKServerException: There is no server specified.---- Error code:-2147217390 Error code name:serverNotFound

com.crystaldecisions12.sdk.occa.report.lib.ReportSDKClientDocException: The document has not been opened.---- Error code:-2147215349 Error code name:docNotReady

Exception in thread "main" java.io.IOException: com.crystaldecisions12.sdk.occa.report.lib.ReportSDKClientDocException: The document has not been opened.---- Error code:-2147215349 Error code name:docNotReady

    at lib.CrystalReportParseUtility$1.visitFile(CrystalReportParseUtility.java:143)

    at lib.CrystalReportParseUtility$1.visitFile(CrystalReportParseUtility.java:1)

    at java.nio.file.Files.walkFileTree(Unknown Source)

    at java.nio.file.Files.walkFileTree(Unknown Source)

    at lib.CrystalReportParseUtility.main(CrystalReportParseUtility.java:129)

Caused by: com.crystaldecisions12.sdk.occa.report.lib.ReportSDKClientDocException: The document has not been opened.---- Error code:-2147215349 Error code name:docNotReady

    at com.crystaldecisions12.sdk.occa.report.lib.ReportSDKClientDocException.throwReportSDKClientDocException(SourceFile:69)

    at com.crystaldecisions12.sdk.occa.report.application.ReportClientDocument.saveAs(SourceFile:2312)

    at lib.CrystalReportParseUtility$1.visitFile(CrystalReportParseUtility.java:140)

    ... 4 more

The second error I get. This error I get when I try to run

    final String DBUSERNAME = "Username";
   final String DBPASSWORD = "password";
   PropertyBag bag;

   

    Map<ITable, ITable> oldNewMap = new HashMap<ITable, ITable>();

   for(Object table :databaseController.getDatabase().getTables()) {
   ITable t = (ITable)((ITable)table).clone(true);
   bag = t.getConnectionInfo().getAttributes();
   bag.replace("Info Object Cuid", "djjdjfkdkgfehherhehr_emrjr");
   t.getConnectionInfo().setAttributes( bag);  
   t.getConnectionInfo().setUserName(DBUSERNAME);
   t.getConnectionInfo().setPassword(DBPASSWORD);
   oldNewMap.put((ITable)table, t);
//   System.out.println( t.getConnectionInfo().getAttributes().get("Info Object Cuid"));
//   System.out.println(" Attribute " +t.getConnectionInfo().getAttributes().get("Info Object Cuid")+ "Database DLL" +
//   t.getConnectionInfo().getAttributes().get("Database DLL") + "Property ID " + t.getConnectionInfo().getAttributes().getPropertyIDs() +
//   "password" + t.getConnectionInfo().getPassword() + "class Name "  + t.getConnectionInfo().getClass() +
//   " Username " + t.getConnectionInfo().getUserName() + "kind "   + t.getConnectionInfo().getKind() );
   }
   for (Entry<ITable, ITable> e : oldNewMap.entrySet()) {
   databaseController.setTableLocation(e.getKey(), e.getValue());
   }  
  

    }

   

10641 [main] ERROR com.businessobjects.reports.sdk.JRCCommunicationAdapter  -  detected an exception: Error finding JNDI name (w12374)

    at com.crystaldecisions.reports.queryengine.Connection.t4(SourceFile:3024)

    at com.crystaldecisions.reports.queryengine.Table.vc(SourceFile:2417)

    at com.crystaldecisions.reports.dataengine.datafoundation.AddDatabaseTableCommand.new(SourceFile:529)

    at com.crystaldecisions.reports.common.CommandManager.a(SourceFile:71)

    at com.crystaldecisions.reports.common.Document.a(SourceFile:203)

    at com.businessobjects.reports.sdk.requesthandler.f.a(SourceFile:175)

    at com.businessobjects.reports.sdk.requesthandler.DatabaseRequestHandler.byte(SourceFile:1079)

    at com.businessobjects.reports.sdk.JRCCommunicationAdapter.do(SourceFile:1166)

    at com.businessobjects.reports.sdk.JRCCommunicationAdapter.if(SourceFile:660)

    at com.businessobjects.reports.sdk.JRCCommunicationAdapter.a(SourceFile:166)

    at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.a(SourceFile:528)

    at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.call(SourceFile:526)

    at com.crystaldecisions.reports.common.ThreadGuard.syncExecute(SourceFile:102)

    at com.businessobjects.reports.sdk.JRCCommunicationAdapter.for(SourceFile:524)

    at com.businessobjects.reports.sdk.JRCCommunicationAdapter.int(SourceFile:423)

    at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(SourceFile:351)

    at com.businessobjects.sdk.erom.jrc.a.a(SourceFile:54)

    at com.businessobjects.sdk.erom.jrc.a.execute(SourceFile:67)

    at com.crystaldecisions.proxy.remoteagent.RemoteAgent$a.execute(SourceFile:716)

    at com.crystaldecisions.proxy.remoteagent.CommunicationChannel.a(SourceFile:125)

    at com.crystaldecisions.proxy.remoteagent.RemoteAgent.a(SourceFile:537)

    at com.crystaldecisions.sdk.occa.report.application.ds.a(SourceFile:186)

    at com.crystaldecisions.sdk.occa.report.application.an.a(SourceFile:108)

    at com.crystaldecisions.sdk.occa.report.application.b0.if(SourceFile:148)

    at com.crystaldecisions.sdk.occa.report.application.b0.b(SourceFile:95)

    at com.crystaldecisions.sdk.occa.report.application.bb.int(SourceFile:96)

    at com.crystaldecisions.proxy.remoteagent.UndoUnitBase.performDo(SourceFile:151)

    at com.crystaldecisions.proxy.remoteagent.UndoUnitBase.a(SourceFile:106)

    at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(SourceFile:2159)

    at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(SourceFile:543)

    at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(SourceFile:3898)

    at com.crystaldecisions.sdk.occa.report.application.DatabaseController.setTableLocation(SourceFile:2906)

    at com.lds.eim.crpu.CrystalReportParseUtility.switch_tables(CrystalReportParseUtility.java:119)

    at com.lds.eim.crpu.CrystalReportParseUtility.crystaldatabaseconnection(CrystalReportParseUtility.java:83)

    at com.lds.eim.crpu.CrystalReportParseUtility.access$4(CrystalReportParseUtility.java:75)

    at com.lds.eim.crpu.CrystalReportParseUtility$1.visitFile(CrystalReportParseUtility.java:137)

    at com.lds.eim.crpu.CrystalReportParseUtility$1.visitFile(CrystalReportParseUtility.java:1)

    at java.nio.file.Files.walkFileTree(Unknown Source)

    at java.nio.file.Files.walkFileTree(Unknown Source)

    at com.lds.eim.crpu.CrystalReportParseUtility.main(CrystalReportParseUtility.java:127)

Please help me to know if this is possible with the api so I can either give up or or solve it/ what I am missing

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Are the crystal reports managed(published to enterprise system) or unmanaged(on local file system).

If your reports are managed reports, refer to the sample below to understand how you can change DB connection of reports

This sample is for 3.1 version of BO, however it should work for BI 4.x, as there are not many changes in RAS SDK from 3.1 to 4.0/4.1

The list of jars to be used for the application and location of jars can be found from the developers guide available at help.sap.com

Thanks,

Prithvi

Former Member
0 Kudos

We have a Business Object server that has shared connections to the database I believe the term used by sap is Relational connections. When we build a report we have to move it from dev to qa to prod all on the dev server. then using promotion manager we promote it qa server and on the QA server we have both QA and Prod connections. Ever time we move a report to a new shared connection(database) we have to fix the report we are trying to do this programatically so we don't have to spend all the time moving them. Does that make more sense? I will look at your example thank you for responding so quickly. Also what jar files are needed to run program

Former Member
0 Kudos

Its possible programmatically Refer to the sample shared in previous post. That is similar to your requirement.

Thanks,

Prithvi