Fork me on GitHub
#sql
<
2019-05-05
>
seancorfield06:05:39

It looks like Presto is really fussy about what additional properties are passed into the driver. As the code stands in clojure.java.jdbc, it won't work with Presto directly. I'm going to need to push an update to the get-connection logic to support it.

seancorfield07:05:02

I just updated next.jdbc to 1.0.0-alpha13 with a fix for this -- if you'll willing to use that instead of clojure.java.jdbc. Then the following db-spec will work

(def db-spec {:dbtype "presto" :dbname "test" :classname "com.facebook.presto.PrestoDriver" :user "me" :password "secret" :port 8080 :host "127.0.0.1"})

seancorfield07:05:53

(! 925)-> clj -Sdeps '{:deps {seancorfield/next.jdbc {:mvn/version "1.0.0-alpha13"} com.facebook.presto/presto-jdbc {:mvn/version "0.219"}}}'
Downloading: seancorfield/next.jdbc/1.0.0-alpha13/next.jdbc-1.0.0-alpha13.pom from 
Downloading: seancorfield/next.jdbc/1.0.0-alpha13/next.jdbc-1.0.0-alpha13.jar from 
Clojure 1.10.0
user=> (require '[next.jdbc :as jdbc])
nil
user=> (def db-spec {:dbtype "presto" :dbname "test" :classname "com.facebook.presto.PrestoDriver" :user "me" :password "secret" :port 8080 :host "127.0.0.1"})
#'user/db-spec
user=> (def ds (jdbc/get-datasource db-spec))
#'user/ds
user=> (jdbc/get-connection ds)
Execution error (SQLException) at com.facebook.presto.jdbc.PrestoDriverUri/setupClient (PrestoDriverUri.java:152).
Authentication using username/password requires SSL to be enabled
user=> 
(an expected error -- but it correctly loads the driver and validates the connection properties by that point)

seancorfield07:05:35

I'll backport this to clojure.java.jdbc but it'll take a while to get released.

seancorfield07:05:11

https://dev.clojure.org/jira/browse/JDBC-178 and it'll be in 0.7.10 whenever that gets released

nha09:05:06

Thanks a lot! Will use the bleeding edge simple_smile

4