ksql-jdbc-driver is a Type 3 Java Database Connectivity (JDBC) driver that provides standard access to Apache Kafka via JDBC API.
In the current version, the driver connects to the KSQL engine to perform queries to Kafka and then, the engine translates those requests to Kafka requests.
Building from source
First of all, the KSQL lib has to be installed into your local repo.
So, cloning the KSQL repo:
git clone https://github.com/confluentinc/ksql.git && cd ksql && git checkout v4.1.0-rc3
and installing it:
mvn clean install -Dmaven.skip.test=true
Probably, you'll have to do the same things for these Confluent projects (previous to the KSQL project installation):
Once you did that, just have to clone the ksql-jdbc-driver repo and package it:
git clone https://github.com/mmolimar/ksql-jdbc-driver.git && cd ksql-jdbc-driver
sbt clean package
To run unit and integration tests, execute the following:
sbt test it:test
To know the test coverage of the driver:
sbt clean coverage test it:test coverageReport
As expected, the driver can be used as we are used to. So, in your application, register the driver (depending on your JVM), for example:
The URL has the form
- <ksql-engine>: represents the KSQL engine host.
- <port>: is the KSQL engine port.
- <propertyN>: are the custom client properties (optionals). Available properties:
secured: sets if the KSQL connection is secured or not. It's a boolean (
false) and its default value is
timeout: sets the max wait time between each message when receiving them. It's a long and its default value is
0which means that is infinite.
- Standalone mode: connecting directly to Kafka brokers.
- Make the driver more compliant with the JDBC spec.
- Source Code: https://github.com/mmolimar/ksql-jdbc-driver
- Issue Tracker: https://github.com/mmolimar/ksql-jdbc-driver/issues
Released under the Apache License, version 2.0.