I am trying to run clojure file as:
============================================
(ns mysql
(:require [clojure.contrib.sql :as sql]))
: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]))
----- Original Message -----
From: "Sean Corfield" <seancorfi...@gmail.com>
To: <clojure@googlegroups.com>
Sent: Friday, December 23, 2011 11:43 PM
Subject: Re: (:require [clojure.contrib.sql :as sql]))
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
On Fri, Dec 23, 2011 at 10:17 PM, jayvandal <s...@ida.net> wrote:
Where is this file to be found??
(:require [clojure.contrib.sql :as sql]))
I see it listed in the jar but??
I have the clojure.contrib-11.2.0.jar located in my classpath
c:\opt\jars, as well as the clojure.jar
Am I the only one who has trouble with these files??
--
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