I have tried the example you provided and it works except I don't see any file printout of the records when I run not as test but without test. Is test going to show any data? Can I ask for a record count? why doesn't the sql jar show for every example that is in the internet? Thanks
On Dec 24, 6:59 pm, Sean Corfield <seancorfi...@gmail.com> wrote: > You're still not answering the question of how exactly you are > _running_ your Clojure code. > > No one is going to be able to help you if you don't provide enough > details about what _exactly_ you are doing and what error / stack > trace you are getting. > > Please also try the command sequence I showed you and see if that works. > > > > > > > > On Sat, Dec 24, 2011 at 5:27 PM, <s...@ida.net> wrote: > > C:\>set classpath > > CLASSPATH=c:/opt/jars/*;c:/projects/clarity4/src > > > C:\> > > > ----- Original Message ----- From: "Sean Corfield" <seancorfi...@gmail.com> > > To: <clojure@googlegroups.com> > > Sent: Saturday, December 24, 2011 4:30 PM > > Subject: Re: (:require [clojure.contrib.sql :as sql])) > > > On Sat, Dec 24, 2011 at 1:49 PM, <s...@ida.net> wrote: > > >> I am trying to run clojure file as: > >> ============================================ > >> (ns mysql > > >> (:require [clojure.contrib.sql :as sql])) > > > Looks like you're missing a line here before :subprotocol...? > > >> :subprotocol "mysql" > >> :subname "//localhost:3306/dummy" > >> :user "root" > >> :password "pass"}) > >> (defn create-users [] > >> (sql/create-table > >> :users > >> [:id :integer "PRIMARY KEY" "AUTO_INCREMENT"] > >> [:fname "varchar(25)"] > >> [:lname "varchar(25)"])) > > >> (defn drop-users [] > >> (sql/drop-table :users)) > >> (sql/with-connection db > >> (create-users)) > >> (defn insert-user [fname lname] > >> (sql/insert-values :users [:fname :lname] [fname lname])) > > >> (sql/with-connection db > >> (insert-user "Sandy" "Brown")) > >> (sql/with-connection db > >> (sql/with-query-results rs ["select * from users"] > >> (dorun (map #(println %) rs)))) > > >> =================================== > >> Do I include this statement to get sql and what is the proper way?? > > >> (:require [clojure.contrib.sql :as sql])) > > > You haven't answered the questions about how you are running your > > Clojure code (what's on your classpath etc). > > > Did you try the process I outlined? > > >> ----- Original Message ----- From: "Sean Corfield" > >> <seancorfi...@gmail.com> > >> The monolithic contrib (1.2.0) has been deprecated. Updated versions > >> of many of the modules are available individually: > > >>http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go > > >> However, if you have the JAR on your classpath, that namespace should > >> be available. > > >> It would help people help you if you provided more detail: > >> * How are you running your Clojure code? > >> * What _exact_ error message (and partial stack trace) are you seeing? > > >> Here's an example workflow that shows you can access > >> clojure.contrib.sql just fine: > > >> sean@sean-netbook:~/clojure$ lein new jay > >> cd Created new project in: /home/sean/clojure/jay > >> Look over project.clj and start coding in jay/core.clj > >> sean@sean-netbook:~/clojure$ cd jay/ > >> sean@sean-netbook:~/clojure/jay$ vi project.clj > >> sean@sean-netbook:~/clojure/jay$ cat project.clj > >> (defproject jay "1.0.0-SNAPSHOT" > >> :description "FIXME: write description" > >> :dependencies [[org.clojure/clojure "1.2.1"] > >> [org.clojure/clojure-contrib "1.2.0"]]) > >> sean@sean-netbook:~/clojure/jay$ lein deps > >> Copying 2 files to /home/sean/clojure/jay/lib > >> sean@sean-netbook:~/clojure/jay$ lein repl > >> REPL started; server listening on localhost port 13024 > >> user=> (ns jay.test (:require [clojure.contrib.sql :as sql])) > >> nil > >> jay.test=> ^D > > >> Sean -- 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