Main Content

close

Close Apache Cassandra database connection

Description

example

close(conn) closes the Cassandra® database connection.

Examples

collapse all

Using a Cassandra® database connection, display the keyspaces and then close the connection.

Create a Cassandra database connection using the local host address. conn is a cassandra object.

contactPoints = "localhost";
conn = cassandra(contactPoints);

Verify that the Cassandra database connection is open.

val = isopen(conn)
val = logical
   1

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

Display the keyspaces in the Cassandra database.

conn.Keyspaces
ans = 1×6 string array
    "employeedata"    "system"    "system_auth"    "system_distributed"    "system_schema"    "system_traces"

Close the Cassandra database connection.

close(conn)

Input Arguments

collapse all

Cassandra database connection, specified as a cassandra object.

Introduced in R2018b