SAP JCo: JCoDestination vs. JCoClient

8.7k views Asked by At

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?

2

There are 2 answers

0
remigio On BEST ANSWER

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".

3
vwegert On

Most of the "stuff" you'll find will implicitly refer to the old version (2.x) of the Java Connector. You can still grab that version from SAP, and I'd encourage you to do so - not to use it, but to compare the javadoc. You'll see that the class structure was changed radically between the 2.x and 3.x releases (and to the better, I'd say). However, that means that you have to re-work many of the examples because the class names have changed.