{"id":13529203,"url":"https://github.com/influxdata/influxdb-java","last_synced_at":"2025-05-12T15:24:00.187Z","repository":{"id":16570046,"uuid":"19323986","full_name":"influxdata/influxdb-java","owner":"influxdata","description":"Java client for InfluxDB","archived":false,"fork":false,"pushed_at":"2025-03-26T08:20:29.000Z","size":1601,"stargazers_count":1190,"open_issues_count":114,"forks_count":477,"subscribers_count":106,"default_branch":"master","last_synced_at":"2025-05-12T15:23:55.632Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/influxdata.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-04-30T18:56:32.000Z","updated_at":"2025-05-09T13:23:17.000Z","dependencies_parsed_at":"2024-01-02T23:41:41.626Z","dependency_job_id":"479160b7-5230-4eba-969b-eada5ac2101e","html_url":"https://github.com/influxdata/influxdb-java","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Finfluxdb-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Finfluxdb-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Finfluxdb-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Finfluxdb-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/influxdata","download_url":"https://codeload.github.com/influxdata/influxdb-java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253764089,"owners_count":21960513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T07:00:34.287Z","updated_at":"2025-05-12T15:24:00.165Z","avatar_url":"https://github.com/influxdata.png","language":"Java","funding_links":[],"categories":["Client libraries","Java"],"sub_categories":["Official"],"readme":"# influxdb-java\n\n[![Build Status](https://github.com/influxdata/influxdb-java/workflows/master/badge.svg)](https://github.com/influxdata/influxdb-java/actions)\n[![codecov.io](http://codecov.io/github/influxdata/influxdb-java/coverage.svg?branch=master)](http://codecov.io/github/influxdata/influxdb-java?branch=master)\n[![Issue Count](https://codeclimate.com/github/influxdata/influxdb-java/badges/issue_count.svg)](https://codeclimate.com/github/influxdata/influxdb-java)\n\nThis is the official (and community-maintained) Java client library for [InfluxDB](https://www.influxdata.com/products/influxdb-overview/) (1.x), the open source time series database that is part of the TICK (Telegraf, InfluxDB, Chronograf, Kapacitor) stack.\n\nFor InfluxDB 3.0 users, this library is succeeded by the lightweight [v3 client library](https://github.com/InfluxCommunity/influxdb3-java).\n\n_Note: This library is for use with InfluxDB 1.x and [2.x compatibility API](https://docs.influxdata.com/influxdb/v2.0/reference/api/influxdb-1x/). For full supports of InfluxDB 2.x features, please use the [influxdb-client-java](https://github.com/influxdata/influxdb-client-java) client._\n\n## Adding the library to your project\n\nThe library artifact is published in Maven central, available at [https://search.maven.org/artifact/org.influxdb/influxdb-java](https://search.maven.org/artifact/org.influxdb/influxdb-java).\n\n### Release versions\n\nMaven dependency:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.influxdb\u003c/groupId\u003e\n  \u003cartifactId\u003einfluxdb-java\u003c/artifactId\u003e\n  \u003cversion\u003e${influxdbClient.version}\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nGradle dependency:\n\n```bash\ncompile group: 'org.influxdb', name: 'influxdb-java', version: \"${influxdbClientVersion}\"\n```\n\n## Features\n\n* Querying data using:\n  * [Influx Query Language (InfluxQL)](https://docs.influxdata.com/influxdb/v1.7/query_language/), with support for [bind parameters](https://docs.influxdata.com/influxdb/v1.7/tools/api/#bind-parameters) (similar to [JDBC PreparedStatement parameters](https://docs.oracle.com/javase/tutorial/jdbc/basics/prepared.html#supply_values_ps));\n  * it's own [QueryBuilder](https://github.com/influxdata/influxdb-java/blob/master/QUERY_BUILDER.md), as you would do with e.g. EclipseLink or Hibernate;\n  * Message Pack (requires InfluxDB [1.4+](https://www.influxdata.com/blog/whats-new-influxdb-oss-1-4/));\n* Writing data using:\n  * Data Point (an object provided by this library that represents a ... data point);\n  * Your own POJO (you need to add a few Java Annotations);\n  * [InfluxDB line protocol](https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_tutorial/) (for the braves only);\n  * UDP, as [supported by InfluxDB](https://docs.influxdata.com/influxdb/v1.7/supported_protocols/udp/);\n* Support synchronous and asynchronous writes;\n* Batch support configurable with `jitter` interval, `buffer` size and `flush` interval.\n\n## Quick start\n\n```Java\n// Create an object to handle the communication with InfluxDB.\n// (best practice tip: reuse the 'influxDB' instance when possible)\nfinal String serverURL = \"http://127.0.0.1:8086\", username = \"root\", password = \"root\";\nfinal InfluxDB influxDB = InfluxDBFactory.connect(serverURL, username, password);\n\n// Create a database...\n// https://docs.influxdata.com/influxdb/v1.7/query_language/database_management/\nString databaseName = \"NOAA_water_database\";\ninfluxDB.query(new Query(\"CREATE DATABASE \" + databaseName));\ninfluxDB.setDatabase(databaseName);\n\n// ... and a retention policy, if necessary.\n// https://docs.influxdata.com/influxdb/v1.7/query_language/database_management/\nString retentionPolicyName = \"one_day_only\";\ninfluxDB.query(new Query(\"CREATE RETENTION POLICY \" + retentionPolicyName\n        + \" ON \" + databaseName + \" DURATION 1d REPLICATION 1 DEFAULT\"));\ninfluxDB.setRetentionPolicy(retentionPolicyName);\n\n// Enable batch writes to get better performance.\ninfluxDB.enableBatch(\n    BatchOptions.DEFAULTS\n      .threadFactory(runnable -\u003e {\n        Thread thread = new Thread(runnable);\n        thread.setDaemon(true);\n        return thread;\n      })\n);\n\n// Close it if your application is terminating or you are not using it anymore.\nRuntime.getRuntime().addShutdownHook(new Thread(influxDB::close));\n\n// Write points to InfluxDB.\ninfluxDB.write(Point.measurement(\"h2o_feet\")\n    .time(System.currentTimeMillis(), TimeUnit.MILLISECONDS)\n    .tag(\"location\", \"santa_monica\")\n    .addField(\"level description\", \"below 3 feet\")\n    .addField(\"water_level\", 2.064d)\n    .build());\n\ninfluxDB.write(Point.measurement(\"h2o_feet\")\n    .time(System.currentTimeMillis(), TimeUnit.MILLISECONDS)\n    .tag(\"location\", \"coyote_creek\")\n    .addField(\"level description\", \"between 6 and 9 feet\")\n    .addField(\"water_level\", 8.12d)\n    .build());\n\n// Wait a few seconds in order to let the InfluxDB client\n// write your points asynchronously (note: you can adjust the\n// internal time interval if you need via 'enableBatch' call).\nThread.sleep(5_000L);\n\n// Query your data using InfluxQL.\n// https://docs.influxdata.com/influxdb/v1.7/query_language/data_exploration/#the-basic-select-statement\nQueryResult queryResult = influxDB.query(new Query(\"SELECT * FROM h2o_feet\"));\n\nSystem.out.println(queryResult);\n// It will print something like:\n// QueryResult [results=[Result [series=[Series [name=h2o_feet, tags=null,\n//      columns=[time, level description, location, water_level],\n//      values=[\n//         [2020-03-22T20:50:12.929Z, below 3 feet, santa_monica, 2.064],\n//         [2020-03-22T20:50:12.929Z, between 6 and 9 feet, coyote_creek, 8.12]\n//      ]]], error=null]], error=null]\n```\n\n## Contribute\n\nFor version change history have a look at [ChangeLog](https://github.com/influxdata/influxdb-java/blob/master/CHANGELOG.md).\n\n### Build Requirements\n\n* Java 1.8+\n* Maven 3.5+\n* Docker (for Unit testing)\n\nThen you can build influxdb-java with all tests with:\n\n```bash\n$\u003e export INFLUXDB_IP=127.0.0.1\n\n$\u003e mvn clean install\n\n```\n\nThere is a shell script running InfluxDB and Maven from inside a Docker container and you can execute it by running:\n\n```bash\n$\u003e ./compile-and-test.sh\n```\n\n## Useful links\n\n* [Manual](MANUAL.md) (main documentation);\n* [InfluxDB Object Mapper](INFLUXDB_MAPPER.md);\n* [Query Builder](QUERY_BUILDER.md);\n* [FAQ](FAQ.md);\n* [Changelog](CHANGELOG.md).\n\n## License\n\n```license\nThe MIT License (MIT)\n\nCopyright (c) 2014 Stefan Majer\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfluxdata%2Finfluxdb-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finfluxdata%2Finfluxdb-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfluxdata%2Finfluxdb-java/lists"}