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