Main Content


Determine if Apache Cassandra database connection is open

Since R2021a



val = isopen(conn) returns 1 if the Cassandra® database connection is open and 0 if it is closed.


collapse all

Using the Apache™ Cassandra® database C++ interface, create a Cassandra database connection and verify that the connection is open. Display the keyspaces in the Cassandra database, and then close the connection.

Create a Cassandra database connection using the configured data source CassandraDataSource and a blank user name and password. The apacheCassandra function returns conn as a connection object.

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

Verify that the Cassandra database connection is open.

val = isopen(conn)
val = logical

The database connection is open because the isopen function returns 1. Otherwise, the database connection is closed.

Display the keyspaces in the Cassandra database.

ans = 6×1 string

Close the Cassandra database connection.


Verify that the Cassandra database connection is closed.

val = isopen(conn)
val = logical

Input Arguments

collapse all

Apache Cassandra database connection, specified as a connection object.

Version History

Introduced in R2021a