share

Monday, 8 June 2015

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"));
        }
    }

}

7 comments:

  1. This substance makes another trust and motivation within me. A debt of gratitude is in order for sharing article this way. The way you have expressed everything above is entirely amazing. Continue blogging this way.
    JAVA Training in Chennai | JAVA Training | JAVA Training institutes in chennai

    ReplyDelete
  2. Hello Admin, thank you for enlightening us with your knowledge sharing.
    Regards,
    J2EE Training in Chennai|JAVA Training in Chennai

    ReplyDelete
  3. The best thing is that your blog really informative thanks for your great information!
    erp software in chennai

    ReplyDelete
  4. Really an amazing post..! By reading your blog post i gained more information.
    Bulk SMS Chennai
    Internet Marketing Company Chennai

    ReplyDelete
  5. 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.

    ReplyDelete
  6. We sharing about Cassandra using with java is really amazing information.I learning about more java technical information in these site.If become a learn for java with big data Professional Hadoop Training in Chennai. Nowadays many IT companies most of the opening for Hadoop Professional.

    ReplyDelete