This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-11-24
Channels
- # announcements (11)
- # babashka (11)
- # beginners (36)
- # biff (14)
- # cider (2)
- # clj-commons (9)
- # clojure (34)
- # clojure-czech (2)
- # clojure-europe (65)
- # clojure-nl (2)
- # clojure-norway (12)
- # clojure-uk (4)
- # clojuredesign-podcast (7)
- # clojurescript (5)
- # cursive (8)
- # deps-new (6)
- # hugsql (1)
- # humbleui (2)
- # hyperfiddle (5)
- # leiningen (21)
- # off-topic (2)
- # polylith (5)
- # practicalli (1)
- # releases (1)
- # sci (64)
- # sql (9)
- # squint (43)
- # test-check (6)
- # vim (7)
Hi guys! I have this code:
(let [ds (jdbc/get-datasource {:dbtype "mysql"
:user "..."
:dbname nil
:password "..."})
databases (->> (jdbc/execute! ds ["SHOW DATABASES"] {:builder-fn rs/as-unqualified-lower-maps})
(into #{} (map :database)))]
I got the following error: No suitable driver found for jdbc:
I have the driver mysql/mysql-connector-java {:mvn/version "5.1.49"}
in the path.
I don't understand why I got this.I just tried this with only next.jdbc
and the 5.1.49 driver and it worked -- so I think something else in your dependencies is causing this problem:
> clj -Sdeps '{:deps {com.github.seancorfield/next.jdbc {:mvn/version "RELEASE"} mysql/mysql-connector-java {:mvn/version "5.1.49"}}}'
Downloading: com/github/seancorfield/next.jdbc/maven-metadata.xml from clojars
Downloading: mysql/mysql-connector-java/5.1.49/mysql-connector-java-5.1.49.pom from central
Downloading: mysql/mysql-connector-java/5.1.49/mysql-connector-java-5.1.49.jar from central
Clojure 1.12.0-alpha5
user=> (require '[next.jdbc :as jdbc])
nil
user=> (def ds (jdbc/get-datasource {:dbtype "mysql" :dbname "worldsingles" :user "root" :password (System/getenv "MYSQL_ROOT_PASSWORD")}))
#'user/ds
user=> (jdbc/execute! ds ["show databases"])
Fri Nov 24 08:09:33 PST 2023 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
[#:SCHEMATA{:Database "information_schema"} #:SCHEMATA{:Database "mysql"} #:SCHEMATA{:Database "performance_schema"} ...]
With the 6.0.6 driver instead, I get this error
Execution error (SSLHandshakeException) at sun.security.ssl.HandshakeContext/<init> (HandshakeContext.java:162).
No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
and if I add :useSSL false
to the db-spec and try again, it works as expected.Indeed there is something else in the project but I don't explain the mistake. I have deep dive to the deps and exclude the other version of the connector but still doesn't work. The workaround for the moment is to use the mysql/mysql-connector-j
If the project is public, I'd be happy to take a look -- but I suspect it isn't?