当使用korma内置的mysql方法时,无法添加utf-8的支持。解决的方法就是重写mysql方法,代码如下:
(defn mysql "改编自korma,添加了utf-8的支持" [{:keys [host port db make-pool?] :or {host "localhost", port 3306, db "", make-pool? true} :as opts}] (merge {:classname "com.mysql.jdbc.Driver" ; must be in classpath :subprotocol "mysql" :subname (str "//" host ":" port "/" db "?useUnicode=true&characterEncoding=UTF-8") :delimiters "`" :make-pool? make-pool?} opts))