SAP JCo: JCoDestination vs. JCoClient

FiveO picture FiveO · Oct 24, 2012 · Viewed 7.9k times · Source

I'm calling a function in SAP 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?

Answer

remigio picture remigio · Oct 24, 2012

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 this URL. Furthermore, at this link 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 in both versions.