To configure the driver to use basic authentication:
  • Set the ServerName property to specify the base URL of the service to which you want to connect. It is comprised of either the domain name or the IP address of the service. For example, for S/4HANA, it can be either https://mycompany.s4hana.ondemand.com or http://123.456.7.8.
  • Set the User property to specify your logon ID.
  • Set the Password property to specify your password.
  • Optionally, specify values for any additional properties you want to configure.

The following examples demonstrate a session with basic authentication enabled.

For a connection URL:

Connection conn = DriverManager.getConnection
("jdbc:datadirect:s4hana:ServerName=https://myinstance.company.com
  User=jsmith;Password=secret;");

For a data source:

S4HanaDataSource mds = new S4HanaDataSource();
mds.setDescription("My S4Hana Data Source");
mds.setServerName("https://myinstance.company.com");