sql

All things SQL and JDBC...
Test This 2020-10-03T23:59:41.050400Z

Would appreciate some help on this. I think this command worked well for me yesterday when I exchanged a couple of messages with Sean Corfield on Github. Today, I am getting an error, and I cannot find where the error is. It appears a character is being used where a string is expected. But I cannot find where I am doing that. The error points to a file in the jdbc library. First, the error and then the code. Short error

Execution error (ClassCastException) at next.jdbc.prepare/create (prepare.clj:97).
class java.lang.Character cannot be cast to class java.lang.String (java.lang.Character and java.lang.String are in module java.base of loader 'bootstrap')

Full report at:
/var/folders/pd/qstqkk3x6vj319xy3q_v_mk0spz7_y/T/clojure-7559147029681234305.edn
Full error report
{:clojure.main/message
 "Execution error (ClassCastException) at next.jdbc.prepare/create (prepare.clj:97).\nclass java.lang.Character cannot be cast to class java.lang.String (java.lang.Character and java.lang.String are in module java.base of loader 'bootstrap')\n",
 :clojure.main/triage
 {:clojure.error/class java.lang.ClassCastException,
  :clojure.error/line 97,
  :clojure.error/cause
  "class java.lang.Character cannot be cast to class java.lang.String (java.lang.Character and java.lang.String are in module java.base of loader 'bootstrap')",
  :clojure.error/symbol next.jdbc.prepare/create,
  :clojure.error/source "prepare.clj",
  :clojure.error/phase :execution},
 :clojure.main/trace
 {:via
  [{:type java.lang.ClassCastException,
    :message
    "class java.lang.Character cannot be cast to class java.lang.String (java.lang.Character and java.lang.String are in module java.base of loader 'bootstrap')",
    :at [next.jdbc.prepare$create invokeStatic "prepare.clj" 97]}],
  :trace
  [[next.jdbc.prepare$create invokeStatic "prepare.clj" 97]
   [next.jdbc.prepare$create invoke "prepare.clj" 86]
   [next.jdbc.result_set$eval2010$fn__2018 invoke "result_set.clj" 828]
   [next.jdbc.protocols$eval931$fn__962$G__922__971
    invoke
    "protocols.clj"
    33]
   [next.jdbc$execute_BANG_ invokeStatic "jdbc.clj" 237]
   [next.jdbc$execute_BANG_ invoke "jdbc.clj" 224]
   [testdb$cleardb invokeStatic "testdb.clj" 29]
   [testdb$cleardb invoke "testdb.clj" 24]
   [testdb$_main invokeStatic "testdb.clj" 35]
   [testdb$_main doInvoke "testdb.clj" 34]
   [clojure.lang.RestFn invoke "RestFn.java" 397]
   [clojure.lang.AFn applyToHelper "AFn.java" 152]
   [clojure.lang.RestFn applyTo "RestFn.java" 132]
   [clojure.lang.Var applyTo "Var.java" 705]
   [clojure.core$apply invokeStatic "core.clj" 665]
   [clojure.main$main_opt invokeStatic "main.clj" 514]
   [clojure.main$main_opt invoke "main.clj" 510]
   [clojure.main$main invokeStatic "main.clj" 664]
   [clojure.main$main doInvoke "main.clj" 616]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.lang.Var applyTo "Var.java" 705]
   [clojure.main main "main.java" 40]],
  :cause
  "class java.lang.Character cannot be cast to class java.lang.String (java.lang.Character and java.lang.String are in module java.base of loader 'bootstrap')"}}
The code deps.edn
{:paths ["src"]
 :deps {org.clojure/clojure {:mvn/version "1.10.1"}
        seancorfield/next.jdbc {:mvn/version "1.1.588"}
        org.postgresql/postgresql {:mvn/version "42.2.10"}}}
testdb.clj
(ns testdb 
  (:require [next.jdbc :as jdbc])
  (:gen-class))

(def ds-postgres 
  (jdbc/get-datasource {:dbtype "postgres" :dbname "postgres"}))

(defn cleardb 
  [dbname]
  (with-open [con (jdbc/get-connection ds-postgres)]
    (let [dropcmd (str "DROP DATABASE IF EXISTS " dbname ";")]
      (println dropcmd)
      (jdbc/execute! con dropcmd)))
  )

(defn -main [& args]
  (cleardb "mydbname"))