MySQL error: classnotfound
WorldsEndless opened this issue · 3 comments
Using
; project.clj
; ...
[hikari-cp "1.8.1"]
[mysql/mysql-connector-java "8.0.7-dmr"]
; ...
ns> (-> env :db)
{:database-name "humhelp", :adapter "mysql", :auto-commit true, :register-mbeans false, :password "humhelp", :username "humhelp", :max-lifetime 1800000, :minimum-idle 10, :connection-timeout 30000, :server-name "localhost", :read-only false, :maximum-pool-size 10, :idle-timeout 600000, :validation-timeout 5000, :pool-name "db-pool"}
ns> (hik/make-datasource (-> env :db))
ClassNotFoundException com.mysql.jdbc.jdbc2.optional.MysqlDataSource java.net.URLClassLoader.findClass (URLClassLoader.java:381)
Indeed, there doesn't seem to be any com.mysql.jdbc.jdbc2 path. What am I missing?
I am seeing this too. In new mysql driver packages, com.mysql.cj.jdbc.MysqlDataSource
seems to be the class we should be using.
One solution could be to change to order of setting datasource-class-name
and adapter in https://github.com/tomekw/hikari-cp/blob/1.8.1/src/hikari_cp/core.clj#L184. If that is done after checking adapter, this should work with specific datasource-classname
. Right now if adapter is not set a jdbc-url is expected.
Shall I give a pr with that change?
If it would get things running, I'd certainly be in support of the change
Thanks for filing the issue, @WorldsEndless. A PR would be great, @vigneshsarma, thanks a lot!