One way to connect to a service is through the JDBC DriverManager using the DriverManager.getConnection() method. As the following example shows, this method specifies a string containing a connection URL.

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;");