sql 2023-04-13

Hi everybody, I try to use a HikariCP threadpool with next.jdbc. this works well with local mysql container but fails when I try to reach AWS instance. We use mysql version 5.7. I tried this repl code without success:

(let [config {:dbtype "mysql",
              :password "***********",
              :dataSourceProperties {:socketTimeout 30},
              :username "*******",
              :port 3306,
              :dbname "dco",
              :host
              "*******."
              :useSSL false}
      reader (connection/->pool HikariDataSource config)]
  (jdbc/execute!
   reader
   (sql/format {:select :column_name
                :from :INFORMATION_SCHEMA.COLUMNS})))
Error returned is :
javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
                                                         
                                                         The last packet successfully received from the server was 2 milliseconds ago.  The last packet sent successfully to the server was 1 milliseconds ago.
     SQLState: "08S01"
    errorCode: 0

Execution error (SSLHandshakeException) at sun.security.ssl.HandshakeContext/<init> (HandshakeContext.java:170).
No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
I try to use play with enabledTLSProtocols or tlsVersions still without success

Hard to say, but that error sounds like AWS requires SSL and you have it turned off.

It works we specify the jdbc-url in the db-spec . It works also without threadpool.

What is the value of :jdbc-url that works? Perhaps you haven't correctly mapped it to the db-spec hash map?

jdbc:mysql://`host`:`port`/`dbname`?useSSL=false

Oh, right, HikariCP doesn't have a useSSL option -- that's why the hash map approach doesn't work.

So, yeah, you'll have to use the JDBC URL approach with HikariCP.

Ok, thanks

You could use next.jdbc.connection/jdbc-url to construct (most of) the URL (without username/password) I think -- that will save you string-bashing.

Ah yes, nice, we built it manually 😅

BTW, did you try putting :useSSL false into the :dataSourceProperties hash map? I'm not sure whether that would work but it's worth trying...

Yes, we tried. It doesn't work

OK, thanks. I'll try to improve the docs in this area: https://github.com/seancorfield/next-jdbc/issues/247

🙏 1