title: How to connect Cassandra using Java class
body: <p>I am doing this  to connect cassandra.But my code is returning an error.. Here is my code</p>
  <pre><code>public class CassandraConnection {
  
  public static void main(String[] args) {
      String serverIp = &quot;166.78.10.41&quot;;
      String keyspace = &quot;gamma&quot;;
      CassandraConnection connection;
  
      Cluster cluster = Cluster.builder()
              .addContactPoints(serverIp)
              .build();
  
      Session session = cluster.connect(keyspace);
  
  
      String cqlStatement = &quot;SELECT * FROM TestCF&quot;;
      for (Row row : session.execute(cqlStatement)) {
          System.out.println(row.toString());
      }
  
  }
  }
  </code></pre>
  <p>this is the error log ..</p>
  <blockquote>
  <p>Failed to execute goal on project CassandraConnection: Could not resolve dependencies for project com.mycompany:CassandraConnection:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: org.specs2:scalaz-effect_2.11.0-SNAPSHOT:jar:7.0.1-SNAPSHOT, org.scalaz:scalaz-effect_2.9.3:jar:7.1.0-SNAPSHOT: Could not find artifact org.specs2:scalaz-effect_2.11.0-SNAPSHOT:jar:7.0.1-SNAPSHOT -&gt; [Help 1]</p>
  <p>To see the full stack trace of the errors, re-run Maven with the -e switch.
  Re-run Maven using the -X switch to enable full debug logging.</p>
  <p>For more information about the errors and possible solutions, please read the following articles: [Help 1] <a href="http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException" rel="noreferrer">http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException</a></p>
  </blockquote>