Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Cassandra refers to the API


May 17, 2021 Cassandra


Table of contents


This chapter covers all the important classes in Cassandra.

Cluster

This class is the driver's primary entry point. It belongs to the com.datastax.driver.core package.

Method

Serial number Method and description
1

Session connect()

It creates a new session on the current cluster and initializes it.

2

void close()

It is used to close cluster instances.

3

static Cluster.Builder builder()

It is used to create a new Cluster.Builder instance.

Cluster.Builder

This class is used to instantiate the Cluster.Builder class.

Method

Serial number Method and description
1

Cluster.Builder addContactPoint(String address)

This method adds contacts to the cluster.

2

Cluster build()

This method uses a given touch point to build a cluster.

Session

This interface holds the connection to the Cassandra cluster. U sing this interface, you can perform CQL queries. It belongs to the com.datastax.driver.core package.

Method

Serial number Method and description
1

void close()

This method is used to close the current session instance.

2

ResultSet execute(Statement statement)

This method is used to execute the query. It requires a statement object.

3

ResultSet execute(String query)

This method is used to execute the query. It requires a query in the form of a String object.

4

PreparedStatement prepare(RegularStatement statement)

The method prepares the query to be provided. The query will be provided as State.

5

PreparedStatement prepare(String query)

The method prepares the query to be provided. The query will be provided in the form of String.