After setting the CLASSPATH, the required connection information needs to be passed in the form of a connection URL. The connection URL takes the form:
jdbc:datadirect:cassandra://server:port;
KeyspaceName=keyspace;[property=value[;...]]
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}}.

where:

server
specifies the name or the IP address of the server to which you want to connect.
port
specifies the port of the server that is listening for connections to the Cassandra keyspace. The default is 9042.
keyspace
specifies the default name of the Cassandra keyspace to which the driver connects. This value is used as the default qualifier for unqualified table names in SQL queries. Note that a Cassandra keyspace is equivalent to a relational database.
property=value
specifies connection property settings. Multiple properties are separated by a semi-colon. For more information on connection properties, see Using Connection Properties.

This example shows how to establish a connection to a Cassandra data store:

Connection conn = DriverManager.getConnection
 ("jdbc:datadirect:cassandra://MyServer:9042;KeyspaceName=MyKS");