%% Create Apache Cassandra Database Connection
% Create a database connection to an Apache Cassandra® database using the Apache Cassandra database C++ interface. To create this connection, you must configure a Cassandra data source. For more information, see the databaseConnectionOptions function. Using a local host address, create the database connection and display the keyspaces in the database.
%
% Create a Cassandra database connection using the configured data source CassandraDataSource and a blank user name and password.

datasource = "CassandraDataSource";
username = "";
password = "";
conn = apacheCassandra(datasource,username,password)

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

conn.Keyspaces

%
% Close the Cassandra database connection.

close(conn)

% Copyright 2020 The MathWorks, Inc.