Java SDK

The GreptimeDB Java ingester library utilizes gRPC for writing data to the database. For how to use the library, please refer to the Java library documentation.

To connect to GreptimeCloud, using information below:

  • Host: <host>
  • Port: 4001
  • Database: <dbname>
  • Username: <username>
  • Password: <password>

The following code snippet shows how to connect to database:

java

  1. String database = "<dbname>";
  2. String[] endpoints = {"<host>:4001"};
  3. AuthInfo authInfo = new AuthInfo("<username>", "<password>");
  4. GreptimeOptions opts = GreptimeOptions.newBuilder(endpoints, database)
  5. .authInfo(authInfo)
  6. .build();
  7. GreptimeDB client = GreptimeDB.create(opts);