I'm trying to use clojure.java.jdbc to insert rows into a database. (The database in question is sqlite).
I can create a table like this:
(def db {:classname "org.sqlite.JDBC"
:subprotocol "sqlite"
:subname "/path/to/my/database"})
(with-connection db (create-table :foo [:bar :int]
[:baz :int]
[:timestamp :datetime]))
And this works. But if I try to insert a row into the database, this fails:
(with-connection db (insert-rows :foo
[1 2 (java.sql.Timestamp. (.getTime (java.util.Date.)))]))
Giving an exception: assertion failure: param count (3) != value count (6).
But if I omit the timestamp field from the table definition and insert-rows operation, there isn't a problem. So what am I doing wrong with the timestamp?