|
1 | | -# KSQL JDBC Driver |
| 1 | +# KSQL JDBC Driver [](https://travis-ci.org/mmolimar/ksql-jdbc-driver)[](https://coveralls.io/github/mmolimar/ksql-jdbc-driver?branch=master) |
2 | 2 |
|
3 | | -ksql-jdbc-driver is a JDBC driver for Apache Kafka. |
| 3 | +**ksql-jdbc-driver** is a Type 3 Java Database Connectivity (JDBC) driver that provides standard access to |
| 4 | +Apache Kafka via JDBC API. |
4 | 5 |
|
5 | | -> *Work in progress |
| 6 | +In the current version, the driver connects to the [KSQL engine](https://www.confluent.io/product/ksql/) to |
| 7 | +perform queries to Kafka and then, the engine translates those requests to Kafka requests. |
| 8 | + |
| 9 | +## Getting started |
| 10 | + |
| 11 | +### Building from source ### |
| 12 | + |
| 13 | +First of all, the KSQL lib has to be installed into your local repo (till now, there isn't a release available). |
| 14 | + |
| 15 | +So, cloning the KSQL repo: |
| 16 | + |
| 17 | +``git clone https://github.com/confluentinc/ksql.git && cd ksql && git checkout 0.1.x`` |
| 18 | + |
| 19 | +and installing it: |
| 20 | + |
| 21 | +``mvn clean install -Dmaven.skip.test=true`` |
| 22 | + |
| 23 | +Once you did that, just have to clone the ksql-jdbc-driver repo and package it: |
| 24 | + |
| 25 | +``git clone https://github.com/mmolimar/ksql-jdbc-driver.git && cd ksql-jdbc-driver`` |
| 26 | + |
| 27 | +``sbt clean package`` |
| 28 | + |
| 29 | +### Running tests ### |
| 30 | + |
| 31 | +To run unit and integration tests, execute the following: |
| 32 | + |
| 33 | +``sbt test it:test`` |
| 34 | + |
| 35 | +#### Coverage ### |
| 36 | + |
| 37 | +To know the test coverage of the driver: |
| 38 | + |
| 39 | +``sbt clean coverage test it:test coverageReport`` |
| 40 | + |
| 41 | +## Usage |
| 42 | + |
| 43 | +As expected, the driver can be used as we are used to. So, in your application, register the driver (depending on |
| 44 | +your JVM), for example: |
| 45 | + |
| 46 | +* ``java.sql.DriverManager.registerDriver(new com.github.mmolimar.ksql.jdbc.KsqlDriver)`` |
| 47 | + |
| 48 | +or |
| 49 | + |
| 50 | +* ``Class.forName("com.github.mmolimar.ksql.jdbc.KsqlDriver")`` |
| 51 | + |
| 52 | +### Connection URL |
| 53 | + |
| 54 | +The URL has the form ``jdbc:ksql://<ksql-engine>:<port>[?<property1>=<value>,<property2>=<value>...]`` |
| 55 | + |
| 56 | +where: |
| 57 | + |
| 58 | +* **\<ksql-engine>**: represents the KSQL engine host. |
| 59 | +* **\<port>**: is the KSQL engine port. |
| 60 | +* **\<propertyN>**: are the custom client properties (optionals). Fow now, there is only one property and it's to |
| 61 | +set if the KSQL connection is secured or not. The property name is ``secured`` and its value is a boolean |
| 62 | +(``true``|``false``). Its default value is ``false``. |
| 63 | + |
| 64 | +## TODO's |
| 65 | + |
| 66 | +- [ ] Standalone mode: connecting directly to Kafka brokers. |
| 67 | +- [ ] Make the driver more compliant with the JDBC spec. |
| 68 | +- [ ] Enable a timeout when waiting for messages in a query. |
6 | 69 |
|
7 | 70 | ## Contribute |
8 | 71 |
|
|
0 commit comments