javabapijcosapjco3

SAP JCo: JCoDestination vs. JCoClient


I'm calling a function in SAP system from Java with the JCo library. So far my call works, but when I look for help in the Internet, there is always a JCoClient that is being used to get the functions, making commits, etc.

But a JCoClient class does not exist in JCo 3.

Instead I use an instance of the JCoDestination that I created with a config file.

What is the difference between JCoClient and JCoDestination? And why is nobody talking about JCoDestination, but always JCoClient?


Solution

  • The SAP Java Connector has been completely reworked from 2 to 3 version. The old JCO.Client class has been substituted with JCoDestination, but it's not just a name change, the library architecture changed completely, so porting code from JCo 2 to JCo 3 is not just a matter of changing class names. For example, to connect to a SAP service with Jco 2 one had to write something like this:

    JCO.Client client = JCO.createClient(...);
    client.connect();
    

    whereas with JCo 3 you have:

    JCoDestination destination = JCoDestinationManager.getDestination(serviceName);
    

    You can find information about the two libraries at SAP JCo Installation. Furthermore, at SAP JCo Migration 2.x-3.0 (Standalone) there is a detailed guide for migration from 2 to 3. The latter link can also be accessed from the left side index on the former link, from which you can access information about "Client Programming SAP JCo 2.x" and "3.0".