Did you mean to define the select within the defentity?

(sql/defentity mytable    (sql/select mytable (sql/fields :id) (sql/
where {:id 1})))

I does this work?

(sql/defentity mytable
  (:pk <<< YOUR PRIMARY KEY AS A KEYWORD>>>)
  (table <<<YOUR TABLE NAME AS A KEYWORD>>>)
 (database devdb))

(sql/select mytable (sql/fields :id) (sql/where {:id 1}))

On Nov 4, 10:44 am, AndyK <andy.kri...@gmail.com> wrote:
> I believe I have setup korma correctly with
> (require '[korma.db :as db])
> (require '[korma.core :as sql])
> (db/defdb devdb (db/mysql {:db "mydb" :host "localhost" :user
> "me" :password "mypass"}))
> (sql/defentity mytable
> (sql/select mytable (sql/fields :id) (sql/where {:id 1})))
>
> But I'm getting
> SQLException:
>  Message: Connections could not be acquired from the underlying
> database!
>  SQLState: null
>  Error Code: 0
>
> (db/get-connection devdb) returns a clojure.lang.PersistentHashMap -
> is that right? or should it be the underlying java.sql.Connection?
>
> I have the mysql driver in my classpath, am able to Class/forName the
> driver, create a connection, and query on the connection - all
> manually. Korma looks pretty cool and I'd like to be using, any ideas?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to