Start of Content Area

Procedure documentation Open Connection  Locate the document in its SAP Library structure

 

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 documentation

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

 

 

 

 

 

 

Opening the Connection

 

 

 

Try {

   mConnection.connect ();

}

catch (Exeption ex)   {

   ex.printStackTrace ();

   System.exit (1)

}

 

 

 

 

 

Related Information

For information on further procedures, see:

Calling a Function and Closing a Connection

Result of the Function Call

The complete example program for establishing a direct connection:

Example Program Connect1

 

 

 

End of Content Area