Hi You're not supposed to specify the insert statement. Try this:
(sql/insert-record :books {:BOOK_ID "%", :BOOK_NAME "joe", :BOOK_PRICE 12, :BOOK_AUTHOR "siley"}) ...using the same values as in your insert statement. Don't know about BOOK_ID, though... -- Henrik On Fri, Jan 6, 2012 at 10:56 PM, jayvandal <s...@ida.net> wrote: > I tried this code : > (defn add-ausers [user] > (sql/with-connection db > (sql/insert-record :books user > ["INSERT INTO books(BOOK_ID, BOOK_NAME, BOOK_PRICE, BOOK_AUTHOR) > VALUES('%','joe','12', 'siley')"]; > > (println rows)))) > > user=> (mysql.core/add-ausers) > java.sql.SQLException: Can not issue data manipulation statements with > executeQu > ery(). (NO_SOURCE_FILE:0) > > What is Query?? > > On Jan 6, 1:20 pm, Allen Johnson <akjohnso...@gmail.com> wrote: > > You'd want to use one of the insert functions for that: > > > > (defn add-user [user] > > (sql/with-connection db > > (sql/insert-record :books user))) > > > > http://clojure.github.com/java.jdbc > > > > Allen > > > > > > > > > > > > > > > > On Fri, Jan 6, 2012 at 3:13 PM, jayvandal <s...@ida.net> wrote: > > > i am using leinningen and mysql example. I can select records as: > > > > > (defn list-ausers [] > > > (sql/with-connection db > > > (sql/with-query-results rows > > > > > ["SELECT * FROM books WHERE BOOK_ID = '1'"] > > > (println rows)))) > > > > > but I can't insert records,i doesn't like the query as: > > > > > (defn add-ausers [] > > > (sql/with-connection db > > > ;(sql/with-query-results rows > > > > > sql ["INSERT INTO books(BOOK_ID, BOOK_NAME, BOOK_PRICE, > > > BOOK_AUTHOR) VALUES('2','joe','12', 'siley')"] > > > (println rows) > > > > > why or? > > > ;) > > > )) > > > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Clojure" group.> To post to this group, send email > tocloj...@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 > > -- > 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 > -- 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