Show TOC

Procedure documentationOpen Connection Locate this document in the navigation structure

Procedure

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 Syntax

Creating a JCO.Client Object

  1. // Change the logon information to your own system/user
  2. mConnection =
  3.    JCO.createClient (“001“, // SAP client
  4.    “<userid>“, // userid
  5.    “****“,	// password
  6.    “EN“,	// language (null for default language)
  7.    “<hostname>“	// application server host name
  8.    “00“); // system number
End of the code.

Open Connection

Syntax Syntax

  1. Try {
  2.    mConnection.connect ();
  3. }
  4. catch (Exeption ex)   {
  5.    ex.printStackTrace ();
  6.    System.exit (1)
  7. }
End of the code.

More Information

For information on further procedures, see:

The complete example program for establishing a direct connection: