After setting the CLASSPATH, the required connection information needs to be passed in the form of a connection URL. The following example includes the properties required for connecting with basic authentication.

Connection URL Syntax

The connection URL takes the following form:

jdbc:datadirect:s4hana:ServerName=servername;User=user_name;Password=password;
[property=value[;...]];

where:

servername
specifies 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.
user_name
specifies the user name that is used to connect to the service.
password
specifies the password used to connect to the service.

Important: The password is a confidential value used to authenticate the application to the server. To prevent unauthorized access, this value must be securely maintained.

property=value
specifies connection property settings. Multiple properties are separated by a semi-colon.

Connection URL Examples

S/4HANA:

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

BW/4HANA:

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