# influxdb3-java
**Repository Path**: dongtianwk/influxdb3-java
## Basic Information
- **Project Name**: influxdb3-java
- **Description**: No description available
- **Primary Language**: Java
- **License**: MIT
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2025-10-17
- **Last Updated**: 2025-10-17
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# InfluxDB 3 Java Client
The Java client that provides an easy and convenient way to interact with InfluxDB 3.
This package supports both writing data to InfluxDB and querying data using the FlightSQL client,
which allows you to execute SQL queries against InfluxDB IOx.
We offer this [Getting Started: InfluxDB 3.0 Java Client Library](https://www.youtube.com/watch?v=EFnG7rUDvR4) video for learning more about the library.
> :warning: This client requires Java 11 and is compatible up to and including Java 21.
## Installation
> :warning: Some JDK internals must be exposed by adding `--add-opens=java.base/java.nio=ALL-UNNAMED` to your JVM arguments.
Add the latest version of the client to your project:
### Maven dependency
```xml
com.influxdbinfluxdb3-java1.4.0
```
### Or when using Gradle
```groovy
dependencies {
implementation "com.influxdb:influxdb3-java:1.4.0"
}
```
## Usage
To start with the client, import the `com.influxdb.v3.client` package and create a `InfluxDBClient` by:
```java
package com.influxdb.v3;
import java.time.Instant;
import java.util.stream.Stream;
import com.influxdb.v3.client.InfluxDBClient;
import com.influxdb.v3.client.query.QueryOptions;
import com.influxdb.v3.client.Point;
public class IOxExample {
public static void main(String[] args) throws Exception {
String host = "https://us-east-1-1.aws.cloud2.influxdata.com";
char[] token = "my-token".toCharArray();
String database = "database";
try (InfluxDBClient client = InfluxDBClient.getInstance(host, token, database)) {
// ...
}
}
}
```
to insert data, you can use code like this:
```java
//
// Write by Point
//
Point point = Point.measurement("temperature")
.setTag("location", "west")
.setField("value", 55.15)
.setTimestamp(Instant.now().minusSeconds(-10));
client.writePoint(point);
//
// Write by LineProtocol
//
String record = "temperature,location=north value=60.0";
client.writeRecord(record);
```
to query your data, you can use code like this:
```java
//
// Query by SQL
//
System.out.printf("--------------------------------------------------------%n");
System.out.printf("| %-8s | %-8s | %-30s |%n", "location", "value", "time");
System.out.printf("--------------------------------------------------------%n");
String sql = "select time,location,value from temperature order by time desc limit 10";
try (Stream