April 2017
Beginner to intermediate
360 pages
9h 35m
English
First, let's write a program, which uses the QueryBuilder API to build an INSERT statement and execute it. Then, we will walk through each method used in the program. To demonstrate this, we will update the email of user alice and set the location as well. Let's the name the program QueryBuilderInsert.java:
import com.datastax.driver.core.Cluster;import com.datastax.driver.core.Session;import com.datastax.driver.core.Statement;import com.datastax.driver.core.querybuilder.QueryBuilder;public class QueryBuilderInsert { public static void main(String[] args) { Cluster cluster = Cluster.builder().addContactPoints("127.0.0.1").build(); Session session = cluster.connect(); Statement statement = QueryBuilder.insertInto("my_status", ...
Read now
Unlock full access