Show TOC

Procedure documentationEstablishing a Connection Locate this document in the navigation structure

 

In this section you find a programming example for structuring a connection to an SAP server using the new JCO connection concept.

Because the connection type (direct or pool connection) is determined by the destination configuration, it is set implicitly by specifying the destination name.

Procedure

Syntax Syntax

Direct connection to an SAP Server

  1. public static void step1Connect() throws JCoException
  2.     {
  3.         JCoDestination destination = JCoDestinationManager.getDestination(DESTINATION_NAME1);
  4.         System.out.println("Attributes:");
  5.         System.out.println(destination.getAttributes());
  6.         System.out.println();
  7.     }
End of the code.

Syntax Syntax

Pool Connection to an SAP Server

  1. public static void step2ConnectUsingPool() throws JCoException
  2.     {
  3.         JCoDestination destination = JCoDestinationManager.getDestination(DESTINATION_NAME2);
  4.         destination.ping();
  5.         System.out.println("Attributes:");
  6.         System.out.println(destination.getAttributes());
  7.         System.out.println();
  8.     }
End of the code.