Here are some of the common types used for querying:
- PreparedStatement: This represents a prepared statement
- Query: This represents a query
- BoundStatement: This is created from a prepared statement with the values bound
- Sessions: This creates a connection to a Cassandra cluster and is used to execute queries
- ResultSet: This denotes the result of a query
- Row: This is a single CQL row
Let's execute a simple query to insert data into the users table of my_status keyspace and fetch some data. Let's the name the program SimpleQuery.java:
import com.datastax.driver.core.Cluster;import com.datastax.driver.core.ResultSet;import com.datastax.driver.core.Row;import com.datastax.driver.core.Session;public class SimpleQuery { public static ...