English 中文(简体)
Cassandra - Referenced Api
  • 时间:2024-12-22

Cassandra - Referenced Api


Previous Page Next Page  

This chapter covers all the important classes in Cassandra.

Cluster

This class is the main entry point of the driver. It belongs to com.datastax.driver.core package.

Methods

S. No. Methods and Description
1

Session connect()

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

2

void close()

It is used to close the cluster instance.

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.

Methods

S. No Methods and Description
1

Cluster.Builder addContactPoint(String address)

This method adds a contact point to cluster.

2

Cluster build()

This method builds the cluster with the given contact points.

Session

This interface holds the connections to Cassandra cluster. Using this interface, you can execute CQL queries. It belongs to com.datastax.driver.core package.

Methods

S. No. Methods 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 a query. It requires a statement object.

3

ResultSet execute(String query)

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

4

PreparedStatement prepare(RegularStatement statement)

This method prepares the provided query. The query is to be provided in the form of a Statement.

5

PreparedStatement prepare(String query)

This method prepares the provided query. The query is to be provided in the form of a String.

Advertisements