Fork me on GitHub
#sql
<
2019-05-04
>
nha22:05:33

Anyone used prestoSQL with clojure JDBC? Doesn’t seem to be supported “out of the box”

seancorfield22:05:08

I've never heard of it -- but if you have the JDBC driver in your deps, you can just provide :classname with the JDBC driver class name.

seancorfield22:05:42

{:dbtype "Presto" :dbname "whatever" :classname "com.presto.JDBCDriver" ...} or whatever class name it has.

nha22:05:03

Oh hello 🙂 thanks I’ll try that

nha23:05:19

I must be missing something

(j/with-db-connection [conn {:dbtype "jdbc:presto"
                                   :dbname "default"
                                   :classname "com.facebook.presto.jdbc.PrestoDriver"
                                   :user "test"
                                   :password "secret"}]
        conn)
      ;;
      ;; java.sql.SQLException: No suitable driver found for jdbc:jdbc:


      (j/get-connection {:dbtype "jdbc:presto"
                         :dbname "default"
                         :classname "com.facebook.presto.jdbc.PrestoDriver"
                         :user "test"
                         :password "secret"})

      ;; java.sql.SQLException: No suitable driver found for jdbc:jdbc:
      ;; looks like jdbc: is repeated?

nha23:05:28

(also time for 😴 for me 🙂 )

seancorfield23:05:09

Remove jdbc: from the :dbtype.

seancorfield23:05:52

And you made sure you added the Facebook JDBC driver to your dependencies (in project.clj or deps.edn)?

nha23:05:07

I tried removing jdbc: and still get

Unhandled java.sql.SQLException
   No suitable driver found for jdbc:jdbc:
I can (import '[com.facebook.presto.jdbc PrestoDriver]) in the same ns

nha23:05:25

but maybe I am targeting the wrong class

nha23:05:55

I will try creating a connection directly from presto and pass it to clojure.java.jdbc later