HTTP header authentication can be used to authenticate with the S/4HANA sandbox hosted at https://api.sap.com.

To configure the driver to use HTTP header authentication:
  • Set the ServerName property to the S/4HANA sandbox instance: https://api.sap.com.
  • Set the AuthenticationMethod property to HTTP Header.
  • Set the AuthHeader property to specify the name of the HTTP header used for authentication.
  • Set the SecurityToken to specify the security token required to make a connection to your endpoint. For example, XaBARTsLZReM.
  • Optionally, specify values for any additional properties you want to configure.

The following examples demonstrate a session with HTTP header authentication enabled.

For a connection URL:

Connection conn = DriverManager.getConnection
  ("jdbc:datadirect:s4hana:ServerName=https://api.sap.com;
  AuthenticationMethod=HttpHeader;AuthHeader=APIKey;SecurityToken=XaBARTsLZReM;");

For a data source:

S4HanaDataSource mds = new S4HanaDataSource();
mds.setDescription("My S4Hana Data Source");
mds.setAuthenticationMethod("HttpHeader");
mds.setAuthHeader("APIKey");
mds.setSecurityToken("XaBARTsLZReM");
mds.setServerName("https://api.sap.com");
Note: If setting the security token using a data source, be aware that the SecurityToken property, like all data source properties, is persisted in clear text.