Skip to content

konikvranik/jdbc-influxdb

Repository files navigation

InfluxDB 50 driver

Basic JDBC query functionality for the InfluxDB.
Intended to help developers and data analyst to inspect data over various GUI.

Caution
This driver does not provide full JDBC functionality and compatibility.

build code QL releasecodecov
Quality Gate StatusSecurity RatingMaintainability RatingReliability RatingTechnical Debt

What is supported

This driver should provide basic query functionality for various IDEs and GUI DB clients. You can send InfluxQL queries which are returned as sets of result sets.

It is capable to fetch all dababase (catalog) names, measurements (table), fields (column) and tags (column & index) from the metadata.

I tested it with IntelliJ Idea’s DB support.

What is not supported

  • SQL syntax. You must send InfluxQL queries.

  • Changing to other database when connection is already open is not implemented yet. #1

  • Ordering by tags or fields (columns other than time).
    InfluxDB doesn’t support ordering except of time.

  • Prepared statements are not implemented yet. #16

  • Callable statements.
    InfluxDB doesn’t support procedures.

  • Write operations.

    • Updating of current records.
      InfluxDB doesn’t support modify operations.

    • Creating of new points is not implemented yet. #2

    • Deleting of the data is not implemented yet. #4

How to use it

Get the driver from the GitHub repo: influxdb-jdbc-0.2.2

For Maven and Gradle see related sections below.

JDBC URL is in the form of jdbc:influxdb:[http://][<USER>:<PASSWORD>]<HOST>[:<PORT>][?db=<DATABASE>].

Example: jdbc:influxdb:localhost:8086?db=telegraf

You can also pass database, username and password as driver properties:

Property Description

username

login to the InfluxDB with this username

user

alias for username

password

login to the InfluxDB with this password

database

use this database after connecting

db

alias fo r database

Gradle

build.gradle
repositories {
    maven {
        url = uri("https://maven.pkg.github.com/konikvranik/jdbc-influxdb")
        credentials {
            username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
            password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
        }
    }
}

dependencies {
    implementation 'net.suteren.jdbc.influxdb:influxdb-jdbc:0.2.2'
}

Maven

settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <activeProfiles>
    <activeProfile>github</activeProfile>
  </activeProfiles>

  <profiles>
    <profile>
      <id>github</id>
      <repositories>
        <repository>
          <id>central</id>
          <url>https://repo1.maven.org/maven2</url>
        </repository>
        <repository>
          <id>github</id>
          <url>https://maven.pkg.github.com/konikvranik/jdbc-influxdb</url>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
    </profile>
  </profiles>

  <servers>
    <server>
      <id>github</id>
      <username>USERNAME</username>
      <password>TOKEN</password>
    </server>
  </servers>
</settings>
pom.xml
<dependency>
  <groupId>net.suteren.jdbc.influxdb</groupId>
  <artifactId>influxdb-jdbc</artifactId>
  <version>0.2.2</version>
</dependency>