0

We are trying to execute presto jdbc connection . We have followed the simple example in

https://www.tutorialspoint.com/apache_presto/apache_presto_jdbc_interface.htm

  • Added the jar ,
  • run as java application in eclipse .

note :

  • Presto is installed in the linux server . presto cli is working fine in the linux . Started presto in linux .
  • We are running this class in Windows machine eclipse ide. We have no firewall in the linux machine .
  • Mysql is also installed in the linux machine . We are able to access mysql in windows using java code . but unable to do it from windows .

Also tried adding ssl =true as shown below connection = DriverManager.getConnection("jdbc:presto://19.255.24.127:8080/mysql/tutorials?user=root&password=Redcar88!&SSL=true");

Exception : java.sql.SQLException: Error executing query at com.facebook.presto.jdbc.PrestoStatement.internalExecute(PrestoStatement.java:279) at com.facebook.presto.jdbc.PrestoStatement.execute(PrestoStatement.java:228) at com.facebook.presto.jdbc.PrestoStatement.executeQuery(PrestoStatement.java:77) at testdbPresto.PrestoJdbcSample.main(PrestoJdbcSample.java:22) Caused by: java.io.UncheckedIOException: javax.net.ssl.SSLException: Unsupported or unrecognized SSL message at com.facebook.presto.jdbc.internal.client.JsonResponse.execute(JsonResponse.java:154) at com.facebook.presto.jdbc.internal.client.StatementClientV1.(StatementClientV1.java:130) at com.facebook.presto.jdbc.internal.client.StatementClientFactory.newStatementClient(StatementClientFactory.java:24) at com.facebook.presto.jdbc.QueryExecutor.startQuery(QueryExecutor.java:46) at com.facebook.presto.jdbc.PrestoConnection.startQuery(PrestoConnection.java:717) at com.facebook.presto.jdbc.PrestoStatement.internalExecute(PrestoStatement.java:240) ... 3 more Caused by: javax.net.ssl.SSLException: Unsupported or unrecognized SSL message at sun.security.ssl.SSLSocketInputRecord.handleUnknownRecord(SSLSocketInputRecord.java:448) at sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:174) at sun.security.ssl.SSLTransport.decode(SSLTransport.java:110) at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1279) at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1188) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:401) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:373) at com.facebook.presto.jdbc.internal.okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:299) at com.facebook.presto.jdbc.internal.okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:268) at com.facebook.presto.jdbc.internal.okhttp3.internal.connection.RealConnection.connect(RealConnection.java:160) at com.facebook.presto.jdbc.internal.okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:256) at com.facebook.presto.jdbc.internal.okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:134) at com.facebook.presto.jdbc.internal.okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:113) at com.facebook.presto.jdbc.internal.okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42) at com.facebook.presto.jdbc.internal.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at com.facebook.presto.jdbc.internal.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at com.facebook.presto.jdbc.internal.okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) at com.facebook.presto.jdbc.internal.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at com.facebook.presto.jdbc.internal.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at com.facebook.presto.jdbc.internal.okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) at com.facebook.presto.jdbc.internal.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at com.facebook.presto.jdbc.internal.okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125) at com.facebook.presto.jdbc.internal.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at com.facebook.presto.jdbc.internal.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at com.facebook.presto.jdbc.internal.client.OkHttpUtil.lambda$basicAuth$1(OkHttpUtil.java:91) at com.facebook.presto.jdbc.internal.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at com.facebook.presto.jdbc.internal.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at com.facebook.presto.jdbc.internal.client.OkHttpUtil.lambda$userAgent$0(OkHttpUtil.java:77) at com.facebook.presto.jdbc.internal.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at com.facebook.presto.jdbc.internal.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at com.facebook.presto.jdbc.internal.okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200) at com.facebook.presto.jdbc.internal.okhttp3.RealCall.execute(RealCall.java:77) at com.facebook.presto.jdbc.internal.client.JsonResponse.execute(JsonResponse.java:131) ... 8 more

config.properties of presto installation . enter image description here In the code i'm using the ip of the machine as Host .

Tarun teja
  • 59
  • 3
  • 7
  • Are you getting same error with latest [Trino (formerly Presto SQL) release](https://trino.io/download.html)? – Piotr Findeisen Feb 05 '21 at 16:09
  • Hi @PiotrFindeisen, Thanks for responding . Yes I have used Trinojdbc driver . Even then i have the same error. Is there anything to be added on the config.properties file of Presto Installation . Any property in anyfile . I'm able to use Presto cli and query in the Linux machine .But when accessing from another machine via code /dbviusualizer . I have this issue . I have added config.properties screenshot file above . can you help me understand if i missed any . Thanks – Tarun teja Feb 08 '21 at 07:37
  • "Unsupported or unrecognized SSL message" - did you add `SSL=true` to your connection string despite the server running without SSL/TLS? – Piotr Findeisen Feb 08 '21 at 08:57
  • Hi @PiotrFindeisen Yes , I have added. code package testdbPresto; String url = "jdbc:trino://78.100.451.37:8080/mysql/tutorials"; Properties properties = new Properties(); properties.setProperty("user", "root"); properties.setProperty("password", "Passowrd!"); properties.setProperty("SSL", "true"); Connection connection = DriverManager.getConnection(url, properties) Statement statement = connection.createStatement(); String sql= "select auth_id, auth_name from mysql.tutorials.author"; ResultSet resultSet = statement.executeQuery(sql); – Tarun teja Feb 08 '21 at 09:56
  • 1
    To use SSL you need to enable SSL on the coordinator. See https://trino.io/docs/current/security/ldap.html#trino-coordinator-node-configuration . Without SSL you can access your Trino without password (remove `SSL` and `password` properties). You can get more troubleshooting help on the [Trino (formerly Presto SQL) Slack](https://trino.io/slack.html). – Piotr Findeisen Feb 08 '21 at 10:25

0 Answers0