After setting the CLASSPATH, the required connection information needs to be passed in the form of a connection URL. The form of the connection URL differs depending on whether you are using a binary or HTTP connection.

Note:
  • Connection property names are case-insensitive. For example, Password is the same as password.
  • For connection properties that support string values, use the following escape sequence to specify values containing leading or trailing spaces and curly brackets: {value}. For example: User={hello } or Password={{hello}}.

For binary connections (the default):

jdbc:datadirect:sparksql://servername:port[;property=value[;...]]

For HTTP connections (TransportMode=http):

jdbc:datadirect:sparksql://servername:port;DatabaseName=database; 
TransportMode=http;[property=value[;...]]
where:
servername
specifies the name or the IP address of the server to which you want to connect.
port
specifies the port number of the server listener. The default is 10000.
property=value
specifies connection property settings. Multiple properties are separated by a semi-colon.

This examples show how to establish a connection to a server with user ID/password authentication.

For binary connections:

Connection conn = DriverManager.getConnection
 ("jdbc:datadirect:sparksql://Server3:10000;
  DatabaseName=Test;User=admin;Password=adminpass");

For HTTP connections:

Connection conn = DriverManager.getConnection
 ("jdbc:datadirect:sparksql://Server3:10000;DatabaseName=MyDB;
  TransportMode=http;User=admin;Password=adminpass";)