ksql-jdbc-driver is a Type 4 Java Database Connectivity (JDBC) driver that provides standard access to Apache Kafka via JDBC API.
The driver connects to the ksqlDB engine then, the engine translates those requests to Kafka requests.
Just 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
If you want to build a fat jar containing both classes and dependencies -for instance, to use it in a JDBC client such as SQuirrel SQL or whichever-, type the following:
sbt clean assembly
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:
java.sql.DriverManager.registerDriver(new com.github.mmolimar.ksql.jdbc.KsqlDriver)
or
Class.forName("com.github.mmolimar.ksql.jdbc.KsqlDriver")
The URL has the form jdbc:ksql://[<username>:<password>@]<ksql-engine>:<port>[?<property1>=<value>&<property2>=<value>...]
where:
secured
: sets if the ksqlDB connection is secured or not. It's a boolean (true
|false
) and its default
value is false
.properties
: enables to set in ksqlDB extra properties from the JDBC URL. It's a boolean (true
|false
)
and its default value is false
.timeout
: sets the max wait time between each message when receiving them. It's a long and its default
value is 0
which means that is infinite.Released under the Apache License, version 2.0.