0

Trying to connect InfluxDB using https://github.com/influxdata/influxdb-java

I didn't see any option for setting ssl as true and verifySSL as false. Its available in php client. Can someone help on it?

There is no proper documentation available for java client to connect influxDB hosted in AWS, where the connection will be a https connection.

Here is the code and exception thrown.

InfluxDB influxDB = InfluxDBFactory.connect(databaseURL , userName, password);
Pong response = influxDB.ping();

Exception Stacktrace:

org.influxdb.InfluxDBIOException: java.net.ProtocolException: Unexpected status line: 
    at org.influxdb.impl.InfluxDBImpl.execute(InfluxDBImpl.java:800)
    at org.influxdb.impl.InfluxDBImpl.executeQuery(InfluxDBImpl.java:783)
    at org.influxdb.impl.InfluxDBImpl.describeDatabases(InfluxDBImpl.java:709)

1 Answer 1

1

Here is a workaround.. some positive result. But, its unsecured way of communication.

    OkHttpClient.Builder builder = new OkHttpClient.Builder();
    builder.hostnameVerifier(new HostnameVerifier() {               
        @Override
        public boolean verify(String hostname, SSLSession session) {
          return true;
        }
   });
   InfluxDB influxDB = InfluxDBFactory.connect(databaseURL , userName, password, builder);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.