jayvandal <jayvan...@gmail.com> writes:

> CompilerException java.lang.RuntimeException: Unable to resolve symbol: 
> init-db
> in this context, compiling:(NO_SOURCE_PATH:1) 
> This is the db.clg file
> =======================================
> (ns jimsweb.models.db
> (:require [clojure.java.jdbc :as sql]))

According to the namespace declaration, the file should be named
src/jimsweb/models/db.clj (if you use the standard leiningen project
setup).

> (def db 
> {:subprotocol "postgresql"
> :subname "//localhost/my_website"
> :user "admin"
> :password "pass"})
>
> (defn init-db []
> (try
> (sql/with-connection
> db
> (sql/create-table
> :users
> [:id "SERIAL"]
> [:handle "varchar(100)"]
> [:pass "varchar(100)"]))
> (catch Exception ex
> (.getMessage (.getNextException ex)))))
>
> jimsweb.server=> (init-db)

You are in a different namespace, so you have to require or use the
namespace defining init-db first.  So either

  (use 'jimsweb.models.db)
  (init-db)

or

  (require '[jimsweb.models.db :as db])
  (db/init-db)

Bye,
Tassilo

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to