Cassandra JDBC driver that works with 2.x and above.
This is nothing but a JDBC driver build on top of existing popular java clients(e.g. DataStax Java Driver). It can be used with SQuirreL SQL for development and Pentaho BI Server for data analysis and reporting.
0.2.0 Release - Proof of Concept
- Write(INSERT/UPDATE/DELETE) support
- PreparedStatement support
- Advanced types(LOBs, Collections and UDTs) support
- Multiple ResultSet support
- Better SQL compatibility(e.g. SELECT INTO, Aggregation functions and probably simple table joins and sub-queries)
- More providers...
...
// Driver driver = new com.github.cassandra.jdbc.CassandraDriver();
Properties props = new Properties();
props.setProperty("user", "cassandra");
props.setProperty("password", "cassandra");
// ":datastax" in the URL is optional, it suggests to use DataStax Java driver as the provider to connect to Cassandra
Connection conn = DriverManager.connect("jdbc:c*:datastax://host1,host2/system_auth?consistencyLevel=one", props);
// change current keyspace from system_auth to system
conn.setCatalog("system");
// query peers table in current keyspace, by default the SQL below will be translated into the following CQL:
// SELECT * FROM peers LIMIT 10000
// Please be aware that the original SQL does not work in Cassandra as table alias is not supported
ResultSet rs = conn.createStatement().executeQuery("select p.* from peers p");
while (rs.next()) {
...
}
...
- Configure Apache Cassandra Driver by including all required libs and set com.github.cassandra.jdbc.CassandraDriver as driver
- Create a new alias using Aapche Cassandra Driver with a valid URL like jdbc:c*://localhost/system and credentials
- That's it! You should now be able to connect to Cassandra using this driver, issue simple queries and browse meta data(columns, indices and primary keys) like any other database in SQuirrel SQL