GithubHelp home page GithubHelp logo

skp33 / cassandra-jdbc-driver Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zhicwu/cassandra-jdbc-driver

0.0 1.0 0.0 420 KB

Cassandra JDBC driver that works with 2.x and above. It can be used in SQuirreL SQL for development, and Pentaho BI Server for data analysis and reporting.

License: Apache License 2.0

Java 100.00%

cassandra-jdbc-driver's Introduction

cassandra-jdbc-driver

Cassandra JDBC driver that works with 2.x and above.

What is this?

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.

Where we are?

0.2.0 Release - Proof of Concept

What's next?

  • 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...

How to use?

Hello World

...
// 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()) {
...
}
...

Connection Properties

Connection Properties

SQuirrel SQL

  1. Configure Apache Cassandra Driver by including all required libs and set com.github.cassandra.jdbc.CassandraDriver as driver Configure Driver
  2. Create a new alias using Aapche Cassandra Driver with a valid URL like jdbc:c*://localhost/system and credentials Configure Alias
  3. 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 Query Trace

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.