Re: Korma - cannot acquire connections
My mistake in the original post - that should've read (sql/defenity mytable) Two seprate forms - the defentity + the select. On Nov 4, 3:21 pm, Base basselh...@gmail.com wrote: 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,AndyKandy.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
Re: Korma - cannot acquire connections
This worked for me, with mysql 5.1 on Ubuntu Natty. The clojure_test library and fruit table already existed. (ns foo.core (use [korma.db]) (use [korma.core])) (defdb mydb {:subprotocol mysql :subname //127.0.0.1:3306/clojure_test :user clojure_test :password clojure_test}) (defentity fruit (database mydb) (table :fruit)) (select fruit) -- 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
Re: Korma - cannot acquire connections
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
Re: Korma - cannot acquire connections
Actually it should read: (sql/defentity mytable (:pk YOUR PRIMARY KEY AS A KEYWORD) (sql/table YOUR TABLE NAME AS A KEYWORD) (sql/database devdb)) (sql/select mytable (sql/fields :id) (sql/where {:id 1})) On Nov 4, 3:21 pm, Base basselh...@gmail.com wrote: 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