To instantiate JCO.Client objects, you do not use a Constructor. Instead, you use the createClient() method of the class JCO. Several versions of this method must be supported:
Connections to a specific application server
Connections to a Load Balancing server group
Connections that are based on the information in the java.util.Properties object. This is particularly useful to avoid hard-coded system and user information in the Java code.
Additional versions are described in the Javadocs .
The example illustrated below shows the version for connections to a specific application server. Creating the JCO.Client object does not create a connection to the SAP Server. This occurs using the subsequent call connect().
Syntax
Creating a JCO.Client Object
// Change the logon information to your own system/user
mConnection =
JCO.createClient (“001“, // SAP client
“<userid>“, // userid
“****“, // password
“EN“, // language (null for default language)
“<hostname>“ // application server host name
“00“); // system number
Open Connection
Syntax
Try {
mConnection.connect ();
}
catch (Exeption ex) {
ex.printStackTrace ();
System.exit (1)
}
For information on further procedures, see:
The complete example program for establishing a direct connection: