Select Data From Cassandra Using 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 SelectFromCassandra {
public static void main(String[] args) {

Cluster cluster = Cluster.builder().addContactPoint(“127.0.0.1”).build();
Session session = cluster.connect(“demo”);

ResultSet rs = session.execute(“SELECT *FROM emp1 WHERE emp_id=500”);
for (Row row : rs) {
System.out.println(“emp_id = “+row.getInt(“emp_id”)+” name = “+row.getString(“name”));
}
}

}

10 comments

  1. Your information about Java is useful for me to know more technical information. Really very informative post you shared here. Keep sharing this type of informative blog. If anyone wants to become a Java professional learn Java Training in Bangalore. Nowadays Java has tons of job opportunities for all professionals.

Leave a Reply

Your email address will not be published. Required fields are marked *

3 + 7 =