0

i have tried to create a simple select count query:

Treasure data Guide

    Properties props = new Properties();
    props.setProperty("user", "someUser");
    props.setProperty("password", "password1");

    // Alternatively, you can use API key instead of user and password
    // props.setProperty("apikey", "(your API key)")

    // For using SSL connection (default is false)
    props.setProperty("useSSL", "true");

    // To run Hive jobs specify "type" parameter. The default is "presto"
    props.setProperty("type", "presto");

    java.sql.Connection conn = DriverManager.getConnection("jdbc:presto://api.treasuredata.com/sample_datasets", props);
    Statement st = conn.createStatement();
    try {
        ResultSet rs = st.executeQuery("SELECT count(1) FROM www_access");
        while (rs.next()) {
            int count = rs.getInt(1);
            System.out.println("result = " + count);
        }
        rs.close();
    } finally {
        st.close();
        conn.close();
    }

How could i solved this error:

HTTP protocol violation: Authentication challenge without WWW-Authenticate header

full stack trace is attached:

    Exception in thread "main" java.sql.SQLException: Error executing query
    at com.facebook.presto.jdbc.PrestoStatement.execute(PrestoStatement.java:232)
    at com.facebook.presto.jdbc.PrestoStatement.executeQuery(PrestoStatement.java:69)
    at com.Xxxxxxxx.DatabaseProvider.main(DatabaseProvider.java:393)
Caused by: java.lang.RuntimeException: Error reading response from server
    at com.facebook.presto.jdbc.internal.airlift.http.client.FullJsonResponseHandler.readResponseBytes(FullJsonResponseHandler.java:75)
    at com.facebook.presto.jdbc.internal.airlift.http.client.FullJsonResponseHandler.handle(FullJsonResponseHandler.java:61)
    at com.facebook.presto.jdbc.internal.airlift.http.client.FullJsonResponseHandler.handle(FullJsonResponseHandler.java:35)
    at com.facebook.presto.jdbc.internal.airlift.http.client.jetty.JettyHttpClient.execute(JettyHttpClient.java:377)
    at com.facebook.presto.jdbc.internal.client.StatementClient.<init>(StatementClient.java:115)
    at com.facebook.presto.jdbc.QueryExecutor.startQuery(QueryExecutor.java:62)
    at com.facebook.presto.jdbc.PrestoConnection.startQuery(PrestoConnection.java:597)
    at com.facebook.presto.jdbc.PrestoStatement.execute(PrestoStatement.java:207)
    ... 2 more
Caused by: java.io.IOException: com.facebook.presto.jdbc.internal.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header
    at com.facebook.presto.jdbc.internal.jetty.client.util.InputStreamResponseListener$Input.toIOException(InputStreamResponseListener.java:353)
    at com.facebook.presto.jdbc.internal.jetty.client.util.InputStreamResponseListener$Input.read(InputStreamResponseListener.java:321)
    at com.facebook.presto.jdbc.internal.guava.io.CountingInputStream.read(CountingInputStream.java:62)
    at java.io.FilterInputStream.read(FilterInputStream.java:107)
    at com.facebook.presto.jdbc.internal.guava.io.ByteStreams.copy(ByteStreams.java:70)
    at com.facebook.presto.jdbc.internal.guava.io.ByteStreams.toByteArray(ByteStreams.java:115)
    at com.facebook.presto.jdbc.internal.airlift.http.client.FullJsonResponseHandler.readResponseBytes(FullJsonResponseHandler.java:72)
    ... 9 more
Caused by: com.facebook.presto.jdbc.internal.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header
    at com.facebook.presto.jdbc.internal.jetty.client.AuthenticationProtocolHandler$AuthenticationListener.onComplete(AuthenticationProtocolHandler.java:114)
    at com.facebook.presto.jdbc.internal.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:193)
    at com.facebook.presto.jdbc.internal.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:185)
    at com.facebook.presto.jdbc.internal.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:457)
    at com.facebook.presto.jdbc.internal.jetty.client.HttpReceiver.responseSuccess(HttpReceiver.java:404)
    at com.facebook.presto.jdbc.internal.jetty.client.http.HttpReceiverOverHTTP.messageComplete(HttpReceiverOverHTTP.java:269)
    at com.facebook.presto.jdbc.internal.jetty.http.HttpParser.parseContent(HttpParser.java:1515)
    at com.facebook.presto.jdbc.internal.jetty.http.HttpParser.parseNext(HttpParser.java:1332)
    at com.facebook.presto.jdbc.internal.jetty.client.http.HttpReceiverOverHTTP.parse(HttpReceiverOverHTTP.java:159)
    at com.facebook.presto.jdbc.internal.jetty.client.http.HttpReceiverOverHTTP.process(HttpReceiverOverHTTP.java:120)
    at com.facebook.presto.jdbc.internal.jetty.client.http.HttpReceiverOverHTTP.receive(HttpReceiverOverHTTP.java:70)
    at com.facebook.presto.jdbc.internal.jetty.client.http.HttpChannelOverHTTP.receive(HttpChannelOverHTTP.java:90)
    at com.facebook.presto.jdbc.internal.jetty.client.http.HttpConnectionOverHTTP.onFillable(HttpConnectionOverHTTP.java:115)
    at com.facebook.presto.jdbc.internal.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
    at com.facebook.presto.jdbc.internal.jetty.io.FillInterest.fillable(FillInterest.java:95)
    at com.facebook.presto.jdbc.internal.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
    at com.facebook.presto.jdbc.internal.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
    at com.facebook.presto.jdbc.internal.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
    at com.facebook.presto.jdbc.internal.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
    at com.facebook.presto.jdbc.internal.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
    at com.facebook.presto.jdbc.internal.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
    at java.lang.Thread.run(Thread.java:745)
2Big2BeSmall
  • 1,348
  • 3
  • 20
  • 40

1 Answers1

1

It looks you are using DATORAMA and its Presto connector. But, Presto on TreasureData doesn't support general Presto connector. So, currently, you can't issue query from DATORAMA to TreasureData directly.

But, the query in Treasure Data can be pushed results into Datorama by using Result output to FTP.

Please check these documents.

https://docs.treasuredata.com/articles/result-into-datorama https://docs.treasuredata.com/articles/result-into-ftp

torut
  • 59
  • 1
  • Its a simple java code create a connection and execute , I'm using presto driver and the snippets they have. What is blocking the query ? – 2Big2BeSmall Jul 20 '16 at 14:10