incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nilabja Banerjee <nilabja.baner...@gmail.com>
Subject Re: Cassandra JDBC
Date Wed, 16 Nov 2011 09:36:38 GMT
Try this.... it should work......

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class InsertData {
    public static void main(String[] args) throws ClassNotFoundException,
SQLException{
    Class.forName("org.apache.cassandra.cql.jdbc.CassandraDriver");
       Connection jdbcConn = DriverManager
         .getConnection("jdbc:cassandra:/@localhost:9160/test");
       Statement stmt = jdbcConn.createStatement();
       ResultSet reset = stmt.executeQuery("select * from users");

       jdbcConn.close();
    }

}


On 16 November 2011 13:55, Jone Lura <jone.lura@ecc.no> wrote:

> Hi,
>
> I downloaded the cassandra-jdbc and built with maven.
>
> And when I am trying to use it in my application I get an exception on the
> following code:
>
> java.sql.Connection conn = DriverManager.getConnection(
> "jdbc:cassandra://localhost:9160/MyKeyspace");
>
> java.lang.IncompatibleClassChangeError: Implementing class
> 	at java.lang.ClassLoader.defineClass1(Native Method)
> 	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
>
>         …
>
> Does anyone have an idea what it might be?
>
>
> Best regards,
>
>
> Jone
>
>
>
>
>

Mime
View raw message