%% Create Cassandra Database Connection Using Port Number
% Using a local host address and port number, create a Cassandra® database connection and display the keyspaces in the database.
%
% Create a Cassandra database connection using the local host address. Specify the port number 9042 by using the 'PortNumber' name-value pair argument.

contactPoints = "localhost";
portnumber = 9042;
conn = cassandra(contactPoints,'PortNumber',portnumber)

% conn is a cassandra object that contains these properties:
% Cluster name
% Host address
% Local data center name
% Keyspaces
%
% Display the keyspaces in the Cassandra database by accessing the Keyspaces property of the cassandra object.

conn.Keyspaces

%
% Close the Cassandra database connection.

close(conn)

% Copyright 2018 The MathWorks, Inc.