AdSenseHeader

How to connect to cassandra  using java

  • Cassandra is Nosql database.First cassandra is developed by Facebook for the inbox search future.
  • First you need to download DatastaxDriver jar for establishing the connection to cassandra database using java.
Sample Java program for establishing connection to cassandra

CassandraConnection.java

import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.Session;

public  class CassandraConnection  {

 public static void main(String[] args)  throws Exception{
  
   String serverIp ="127.0.0.1";
   String keyspace = "mykeyspace";
   Cluster cluster = Cluster.builder()
              .addContactPoints(serverIp)
              .build();
   Session session = cluster.connect(keyspace);
   System.out.println("Connection Established");
   
 }

}
In the above java program defining the server ip address.This Ip is getting where the cassandra is installed. Keyspace is nothing but database.By using keyspace we can create tables or columnfamilies in cassandra. 


4 comments:

  1. Really it was an awesome article, very interesting to read.
    Salesforce Certification Australia   

    ReplyDelete
  2. If you are looking for a job oriented practical based workday course syllabus curriculum at Workday training institutes in India then you are arrived at the right place called Workday training institutes in ameerpet because this institute is quite popular for this wonderful course not just in Workday training institutes in Jaipur and also proving job assistance for Workday training institutes in Pune

    ReplyDelete
  3. Myself so glad to establish your blog entry since it's actually quite instructive. If it's not too much trouble continue composing this sort of web journals and I normally visit this blog. Examine my administrations.
    Go through these Salesforce Lightning Features course. Found this Salesforce CRM Using Apex And Visualforce Training worth joining. Enroll for SalesForce CRM Integration Training Program and practice well.

    ReplyDelete
  4. Great Article
    Cyber Security Projects

    projects for cse

    Networking Projects

    JavaScript Training in Chennai

    JavaScript Training in Chennai

    The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

    ReplyDelete

 
Top