Re: mysql and clojure
thank for your help, i had doubt about namespace but as i focused on sql i did not check it, it is just a week i use clojure, but i'm used many Scheme and LisP and Java and there is a lot of issue on stackoverflow or stackechange about clojure and mysql that are out of date and are confusing damien On Thursday, October 19, 2017 at 6:44:46 PM UTC+2, Sean Corfield wrote: > > I don’t know what documentation you’re working from but it looks outdated, > based on your code. > > > > Have a read of > http://clojure-doc.org/articles/ecosystem/java_jdbc/home.html -- that > will walk you through the basics of using java.jdbc > > > > If you’re on the Clojurians Slack (signup at http://clojurians.net/ and > read/post messages from https://clojurians.slack.com/ or use a desktop > client), there’s a #sql channel for all things JDBC-related. > > > > Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN > An Architect's View -- http://corfield.org/ > > "If you're not annoying somebody, you're not really alive." > -- Margaret Atwood > > > -- > *From:* clo...@googlegroups.com <clo...@googlegroups.com > > on behalf of Damien Mattei <damien...@gmail.com > > > *Sent:* Thursday, October 19, 2017 3:37:08 AM > *To:* Clojure > *Subject:* mysql and clojure > > hello again, > > i tried dozen of web example about mysql and clojure but it doen't work, > here is some of my code: > > for dependencies: > > (defproject jclojure "0.1.0-SNAPSHOT" > :description "clojure JVM source code for Sidonie web interface > administration" > :url "https://sidonie.oca.eu; > :license {:name "Eclipse Public License" > :url "http://www.eclipse.org/legal/epl-v10.html"} > > :dependencies [ > [org.clojure/clojure "1.8.0"] > [mysql/mysql-connector-java "5.1.38"] > [org.clojure/java.jdbc "0.7.3"] > ] > > :main ^:skip-aot jclojure.core > :target-path "target/%s" > :profiles {:uberjar {:aot :all}}) > > > the code (some of...): > > (ns jclojure.core > (:gen-class)) > > (defn -main > "I don't do a whole lot ... yet." > [& args] > > ;(:require [clojure.java [jdbc :as sql]]) > > ;(require '[clojure.java.jdbc :as jdbc]) > > (ns dbns > (:require [clojure.java.jdbc :as jdbc] > [mysql/mysql-connector-java "5.1.38"])) > > ;(use 'clojure.java.jdbc) > > (println "Hello, World!") > > (let [ > db-host "localhost" > db-port 3306 > db-name "sidonie" > ] > > (def db { > :classname "com.mysql.jdbc.Driver" ; must be in classpath > :subprotocol "mysql" > :subname (str "//" db-host ":" db-port "/" db-name) > ; Any additional keys are passed to the driver > ; as driver-specific properties. > :user "mattei" > :password "sidonie2"})) > > ;(jdbc/query db ["SELECT * FROM Sigles"]) > > (jdbc/with-connection db > (jdbc/with-query-results rows > ["select * from Sigles"] > (println rows))) > > > ) > > > and now the error: > > [mattei@moita jclojure]$ lein run > Exception in thread "main" java.lang.RuntimeException: No such namespace: > jdbc, compiling:(jclojure/core.clj:37:3) > at clojure.lang.Compiler.analyze(Compiler.java:6688) > at clojure.lang.Compiler.analyze(Compiler.java:6625) > at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3766) > at clojure.lang.Compiler.analyzeSeq(Compiler.java:6870) > at clojure.lang.Compiler.analyze(Compiler.java:6669) > at clojure.lang.Compiler.analyze(Compiler.java:6625) > at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:6001) > at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5380) > at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3972) > at clojure.lang.Compiler.analyzeSeq(Compiler.java:6866) > at clojure.lang.Compiler.analyze(Compiler.java:6669) > at clojure.lang.Compiler.analyzeSeq(Compiler.java:6856) > at clojure.lang.Compiler.analyze(Compiler.java:6669) > at clojure.lang.Compiler.access$300(Compiler.java:38) > at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:589) > at clojure.lang.Compiler.analyzeSeq(Compiler.java:6868) > at clojure.lang.Compiler.
RE: mysql and clojure
I don’t know what documentation you’re working from but it looks outdated, based on your code. Have a read of http://clojure-doc.org/articles/ecosystem/java_jdbc/home.html -- that will walk you through the basics of using java.jdbc If you’re on the Clojurians Slack (signup at http://clojurians.net/ and read/post messages from https://clojurians.slack.com/ or use a desktop client), there’s a #sql channel for all things JDBC-related. Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN An Architect's View -- http://corfield.org/ "If you're not annoying somebody, you're not really alive." -- Margaret Atwood From: clojure@googlegroups.com <clojure@googlegroups.com> on behalf of Damien Mattei <damien.mat...@gmail.com> Sent: Thursday, October 19, 2017 3:37:08 AM To: Clojure Subject: mysql and clojure hello again, i tried dozen of web example about mysql and clojure but it doen't work, here is some of my code: for dependencies: (defproject jclojure "0.1.0-SNAPSHOT" :description "clojure JVM source code for Sidonie web interface administration" :url "https://sidonie.oca.eu; :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [ [org.clojure/clojure "1.8.0"] [mysql/mysql-connector-java "5.1.38"] [org.clojure/java.jdbc "0.7.3"] ] :main ^:skip-aot jclojure.core :target-path "target/%s" :profiles {:uberjar {:aot :all}}) the code (some of...): (ns jclojure.core (:gen-class)) (defn -main "I don't do a whole lot ... yet." [& args] ;(:require [clojure.java [jdbc :as sql]]) ;(require '[clojure.java.jdbc :as jdbc]) (ns dbns (:require [clojure.java.jdbc :as jdbc] [mysql/mysql-connector-java "5.1.38"])) ;(use 'clojure.java.jdbc) (println "Hello, World!") (let [ db-host "localhost" db-port 3306 db-name "sidonie" ] (def db { :classname "com.mysql.jdbc.Driver" ; must be in classpath :subprotocol "mysql" :subname (str "//" db-host ":" db-port "/" db-name) ; Any additional keys are passed to the driver ; as driver-specific properties. :user "mattei" :password "sidonie2"})) ;(jdbc/query db ["SELECT * FROM Sigles"]) (jdbc/with-connection db (jdbc/with-query-results rows ["select * from Sigles"] (println rows))) ) and now the error: [mattei@moita jclojure]$ lein run Exception in thread "main" java.lang.RuntimeException: No such namespace: jdbc, compiling:(jclojure/core.clj:37:3) at clojure.lang.Compiler.analyze(Compiler.java:6688) at clojure.lang.Compiler.analyze(Compiler.java:6625) at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3766) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6870) at clojure.lang.Compiler.analyze(Compiler.java:6669) at clojure.lang.Compiler.analyze(Compiler.java:6625) at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:6001) at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5380) at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3972) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6866) at clojure.lang.Compiler.analyze(Compiler.java:6669) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6856) at clojure.lang.Compiler.analyze(Compiler.java:6669) at clojure.lang.Compiler.access$300(Compiler.java:38) at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:589) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6868) at clojure.lang.Compiler.analyze(Compiler.java:6669) at clojure.lang.Compiler.analyze(Compiler.java:6625) at clojure.lang.Compiler.eval(Compiler.java:6931) at clojure.lang.Compiler.load(Compiler.java:7379) at clojure.lang.RT.loadResourceScript(RT.java:372) at clojure.lang.RT.loadResourceScript(RT.java:363) at clojure.lang.RT.load(RT.java:453) at clojure.lang.RT.load(RT.java:419) at clojure.core$load$fn__5677.invoke(core.clj:5893) at clojure.core$load.invokeStatic(core.clj:5892) at clojure.core$load.doInvoke(core.clj:5876) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invokeStatic(core.clj:5697) at clojure.core$load_one.invoke(core.clj:5692) at clojure.core$load_lib$fn__5626.invoke(core.clj:5737) at clojure.core$load_lib.invokeStatic(core.clj:5736) at clojure.core$load_lib.doInvoke(core.clj:5717) at clojure.lang.RestFn.applyTo(RestFn.java:142) at clojure.core$app
Re: mysql and clojure
Cool. You had to remove it, cause it was a leiningen dependency, not a proper :require clause - I guess I didn't pay enough attention too :) It looks like you are trying to learn by example and are skipping the basics. If you havent - this is very nice and gentle introduction that will help you lay the foundations - https://www.braveclojure.com/ On Thursday, 19 October 2017 16:10:39 UTC+3, Damien Mattei wrote: > > Thank Lubomir, > it works, i'm new to Clojure and did not use the name space the right way, > i had to remove [mysql/mysql-connector-java "5.1.38"] also , do not know > why... > > here is the working code and result: > > (ns jclojure.core > (:gen-class) > (:require [clojure.java.jdbc :as jdbc] ) > ) > > ;(ns jclojure.core > ;(:gen-class) > ;(:require [clojure.java.jdbc :as jdbc] > ; [mysql/mysql-connector-java "5.1.38"])) > > > (defn -main > "I don't do a whole lot ... yet." > [& args] > > ;(:require [clojure.java [jdbc :as sql]]) > > ;(require '[clojure.java.jdbc :as jdbc]) > > ;(ns dbns >; (:require [clojure.java.jdbc :as jdbc] > ;[mysql/mysql-connector-java "5.1.38"])) > > ;(use 'clojure.java.jdbc) > > (println "Hello, World!") > > (let [ > db-host "localhost" > db-port 3306 > db-name "sidonie" > ] > > (def db { > :classname "com.mysql.jdbc.Driver" ; must be in classpath > :subprotocol "mysql" > :subname (str "//" db-host ":" db-port "/" db-name) > ; Any additional keys are passed to the driver > ; as driver-specific properties. > :user "mattei" > :password "sidonie2"})) > > ;(jdbc/query db ["SELECT * FROM Sigles"]) > > (jdbc/query db > ["select * from Sigles"] > {:row-fn println} ) > > ;(jdbc/with-connection db > ;(jdbc/with-query-results rows > ; ["select * from Sigles"] > ; (println rows))) > > > ) > > [mattei@moita jclojure]$ lein run > Hello, World! > {:sigle ApJ, :intitulé AstroPhysical Journal} > {:sigle ApJS, :intitulé AstroPhysical Journal - supplement} > {:sigle A, :intitulé Astronomy and Astrophysics} > {:sigle A, :intitulé Astronomy and Astrophysics - supplement series} > {:sigle A.A.W., :intitulé Acta Astronomica Warszawa} > {:sigle ABO, :intitulé Annals Bosscha Observatory} > {:sigle ABS, :intitulé Annals Bosscha Sterrenwacht} > {:sigle ADONU, :intitulé Annals Dearborn Observatory - Northwestern > University} > {:sigle AJ, :intitulé Astronomical Journal} > {:sigle AJS, :intitulé Astronomical Journal - supplement} > {:sigle AN, :intitulé Astronomische Nachrichten} > {:sigle AORB, :intitulé Annales de l'Observatoire Royal de Belgique} > {:sigle AOS, :intitulé Annales de l'Observatoire > > ... > > > Damien > > > On Thursday, October 19, 2017 at 12:49:31 PM UTC+2, Lubomir Konstantinov > wrote: >> >> Bad case of copy pasta? >> >> You have am extra namespace definition: >> >> (ns dbns >> (:require [clojure.java.jdbc :as jdbc] >> [mysql/mysql-connector-java "5.1.38"])) >> >> You need to remove it, and move the require clause up in your ns: >> >> (ns jclojure.core >> (:gen-class) >> (:require [clojure.java.jdbc :as jdbc] >> [mysql/mysql-connector-java "5.1.38"])) >> >> On Thursday, 19 October 2017 13:37:08 UTC+3, Damien Mattei wrote: >>> >>> hello again, >>> >>> i tried dozen of web example about mysql and clojure but it doen't work, >>> here is some of my code: >>> >>> for dependencies: >>> >>> (defproject jclojure "0.1.0-SNAPSHOT" >>> :description "clojure JVM source code for Sidonie web interface >>> administration" >>> :url "https://sidonie.oca.eu; >>> :license {:name "Eclipse Public License" >>> :url "http://www.eclipse.org/legal/epl-v10.html"} >>> >>> :dependencies [ >>> [org.clojure/clojure "1.8.0"] >>> [mysql/mysql-connector-java "5.1.38"] >>> [org.clojure/java.jdbc "0.7.3"] >>> ] >>> >>> :main ^:skip-aot jclojure.core >>> :target-path "target/%s" >>> :profiles {:uberjar {:aot :all}}) &g
Re: mysql and clojure
Have a look at dbcon.clj and db.clj in my https://github.com/Bost/ufo It's a rather minimal example of clojure/clojurescript + mysql 2017-10-19 15:10 GMT+02:00 Damien Mattei <damien.mat...@gmail.com>: > Thank Lubomir, > it works, i'm new to Clojure and did not use the name space the right way, i > had to remove [mysql/mysql-connector-java "5.1.38"] also , do not know > why... > > here is the working code and result: > > (ns jclojure.core > (:gen-class) > (:require [clojure.java.jdbc :as jdbc] ) > ) > > ;(ns jclojure.core > ;(:gen-class) > ;(:require [clojure.java.jdbc :as jdbc] > ; [mysql/mysql-connector-java "5.1.38"])) > > > (defn -main > "I don't do a whole lot ... yet." > [& args] > > ;(:require [clojure.java [jdbc :as sql]]) > > ;(require '[clojure.java.jdbc :as jdbc]) > > ;(ns dbns >; (:require [clojure.java.jdbc :as jdbc] > ;[mysql/mysql-connector-java "5.1.38"])) > > ;(use 'clojure.java.jdbc) > > (println "Hello, World!") > > (let [ > db-host "localhost" > db-port 3306 > db-name "sidonie" > ] > > (def db { > :classname "com.mysql.jdbc.Driver" ; must be in classpath > :subprotocol "mysql" > :subname (str "//" db-host ":" db-port "/" db-name) > ; Any additional keys are passed to the driver > ; as driver-specific properties. > :user "mattei" > :password "sidonie2"})) > > ;(jdbc/query db ["SELECT * FROM Sigles"]) > > (jdbc/query db > ["select * from Sigles"] > {:row-fn println} ) > > ;(jdbc/with-connection db > ;(jdbc/with-query-results rows > ; ["select * from Sigles"] > ; (println rows))) > > > ) > > [mattei@moita jclojure]$ lein run > Hello, World! > {:sigle ApJ, :intitulé AstroPhysical Journal} > {:sigle ApJS, :intitulé AstroPhysical Journal - supplement} > {:sigle A, :intitulé Astronomy and Astrophysics} > {:sigle A, :intitulé Astronomy and Astrophysics - supplement series} > {:sigle A.A.W., :intitulé Acta Astronomica Warszawa} > {:sigle ABO, :intitulé Annals Bosscha Observatory} > {:sigle ABS, :intitulé Annals Bosscha Sterrenwacht} > {:sigle ADONU, :intitulé Annals Dearborn Observatory - Northwestern > University} > {:sigle AJ, :intitulé Astronomical Journal} > {:sigle AJS, :intitulé Astronomical Journal - supplement} > {:sigle AN, :intitulé Astronomische Nachrichten} > {:sigle AORB, :intitulé Annales de l'Observatoire Royal de Belgique} > {:sigle AOS, :intitulé Annales de l'Observatoire > > ... > > > Damien > > > > On Thursday, October 19, 2017 at 12:49:31 PM UTC+2, Lubomir Konstantinov > wrote: >> >> Bad case of copy pasta? >> >> You have am extra namespace definition: >> >> (ns dbns >> (:require [clojure.java.jdbc :as jdbc] >> [mysql/mysql-connector-java "5.1.38"])) >> >> You need to remove it, and move the require clause up in your ns: >> >> (ns jclojure.core >> (:gen-class) >> (:require [clojure.java.jdbc :as jdbc] >> [mysql/mysql-connector-java "5.1.38"])) >> >> On Thursday, 19 October 2017 13:37:08 UTC+3, Damien Mattei wrote: >>> >>> hello again, >>> >>> i tried dozen of web example about mysql and clojure but it doen't work, >>> here is some of my code: >>> >>> for dependencies: >>> >>> (defproject jclojure "0.1.0-SNAPSHOT" >>> :description "clojure JVM source code for Sidonie web interface >>> administration" >>> :url "https://sidonie.oca.eu; >>> :license {:name "Eclipse Public License" >>> :url "http://www.eclipse.org/legal/epl-v10.html"} >>> >>> :dependencies [ >>> [org.clojure/clojure "1.8.0"] >>> [mysql/mysql-connector-java "5.1.38"] >>> [org.clojure/java.jdbc "0.7.3"] >>> ] >>> >>> :main ^:skip-aot jclojure.core >>> :target-path "target/%s" >>> :profiles {:uberjar {:aot :all}}) >>> >>> >>> the code (some of...): >>> >>> (ns jclojure.core >>> (:gen-class)) >>> >>> (defn -main >>> "I don't do a whole lot ... yet." >>>
Re: mysql and clojure
Thank Lubomir, it works, i'm new to Clojure and did not use the name space the right way, i had to remove [mysql/mysql-connector-java "5.1.38"] also , do not know why... here is the working code and result: (ns jclojure.core (:gen-class) (:require [clojure.java.jdbc :as jdbc] ) ) ;(ns jclojure.core ;(:gen-class) ;(:require [clojure.java.jdbc :as jdbc] ; [mysql/mysql-connector-java "5.1.38"])) (defn -main "I don't do a whole lot ... yet." [& args] ;(:require [clojure.java [jdbc :as sql]]) ;(require '[clojure.java.jdbc :as jdbc]) ;(ns dbns ; (:require [clojure.java.jdbc :as jdbc] ;[mysql/mysql-connector-java "5.1.38"])) ;(use 'clojure.java.jdbc) (println "Hello, World!") (let [ db-host "localhost" db-port 3306 db-name "sidonie" ] (def db { :classname "com.mysql.jdbc.Driver" ; must be in classpath :subprotocol "mysql" :subname (str "//" db-host ":" db-port "/" db-name) ; Any additional keys are passed to the driver ; as driver-specific properties. :user "mattei" :password "sidonie2"})) ;(jdbc/query db ["SELECT * FROM Sigles"]) (jdbc/query db ["select * from Sigles"] {:row-fn println} ) ;(jdbc/with-connection db ;(jdbc/with-query-results rows ; ["select * from Sigles"] ; (println rows))) ) [mattei@moita jclojure]$ lein run Hello, World! {:sigle ApJ, :intitulé AstroPhysical Journal} {:sigle ApJS, :intitulé AstroPhysical Journal - supplement} {:sigle A, :intitulé Astronomy and Astrophysics} {:sigle A, :intitulé Astronomy and Astrophysics - supplement series} {:sigle A.A.W., :intitulé Acta Astronomica Warszawa} {:sigle ABO, :intitulé Annals Bosscha Observatory} {:sigle ABS, :intitulé Annals Bosscha Sterrenwacht} {:sigle ADONU, :intitulé Annals Dearborn Observatory - Northwestern University} {:sigle AJ, :intitulé Astronomical Journal} {:sigle AJS, :intitulé Astronomical Journal - supplement} {:sigle AN, :intitulé Astronomische Nachrichten} {:sigle AORB, :intitulé Annales de l'Observatoire Royal de Belgique} {:sigle AOS, :intitulé Annales de l'Observatoire ... Damien On Thursday, October 19, 2017 at 12:49:31 PM UTC+2, Lubomir Konstantinov wrote: > > Bad case of copy pasta? > > You have am extra namespace definition: > > (ns dbns > (:require [clojure.java.jdbc :as jdbc] > [mysql/mysql-connector-java "5.1.38"])) > > You need to remove it, and move the require clause up in your ns: > > (ns jclojure.core > (:gen-class) > (:require [clojure.java.jdbc :as jdbc] > [mysql/mysql-connector-java "5.1.38"])) > > On Thursday, 19 October 2017 13:37:08 UTC+3, Damien Mattei wrote: >> >> hello again, >> >> i tried dozen of web example about mysql and clojure but it doen't work, >> here is some of my code: >> >> for dependencies: >> >> (defproject jclojure "0.1.0-SNAPSHOT" >> :description "clojure JVM source code for Sidonie web interface >> administration" >> :url "https://sidonie.oca.eu; >> :license {:name "Eclipse Public License" >> :url "http://www.eclipse.org/legal/epl-v10.html"} >> >> :dependencies [ >> [org.clojure/clojure "1.8.0"] >> [mysql/mysql-connector-java "5.1.38"] >> [org.clojure/java.jdbc "0.7.3"] >> ] >> >> :main ^:skip-aot jclojure.core >> :target-path "target/%s" >> :profiles {:uberjar {:aot :all}}) >> >> >> the code (some of...): >> >> (ns jclojure.core >> (:gen-class)) >> >> (defn -main >> "I don't do a whole lot ... yet." >> [& args] >> >> ;(:require [clojure.java [jdbc :as sql]]) >> >> ;(require '[clojure.java.jdbc :as jdbc]) >> >> (ns dbns >> (:require [clojure.java.jdbc :as jdbc] >> [mysql/mysql-connector-java "5.1.38"])) >> >> ;(use 'clojure.java.jdbc) >> >> (println "Hello, World!") >> >> (let [ >> db-host "localhost" >> db-port 3306 >> db-name "sidonie" >> ] >> >> (def db { >> :classname "com.mysql.jdbc.Driver" ; must be in classpath >> :subprotocol "mysql" >> :subname (str "//" db-host ":" db-port "
Re: mysql and clojure
Bad case of copy pasta? You have am extra namespace definition: (ns dbns (:require [clojure.java.jdbc :as jdbc] [mysql/mysql-connector-java "5.1.38"])) You need to remove it, and move the require clause up in your ns: (ns jclojure.core (:gen-class) (:require [clojure.java.jdbc :as jdbc] [mysql/mysql-connector-java "5.1.38"])) On Thursday, 19 October 2017 13:37:08 UTC+3, Damien Mattei wrote: > > hello again, > > i tried dozen of web example about mysql and clojure but it doen't work, > here is some of my code: > > for dependencies: > > (defproject jclojure "0.1.0-SNAPSHOT" > :description "clojure JVM source code for Sidonie web interface > administration" > :url "https://sidonie.oca.eu; > :license {:name "Eclipse Public License" > :url "http://www.eclipse.org/legal/epl-v10.html"} > > :dependencies [ > [org.clojure/clojure "1.8.0"] > [mysql/mysql-connector-java "5.1.38"] > [org.clojure/java.jdbc "0.7.3"] > ] > > :main ^:skip-aot jclojure.core > :target-path "target/%s" > :profiles {:uberjar {:aot :all}}) > > > the code (some of...): > > (ns jclojure.core > (:gen-class)) > > (defn -main > "I don't do a whole lot ... yet." > [& args] > > ;(:require [clojure.java [jdbc :as sql]]) > > ;(require '[clojure.java.jdbc :as jdbc]) > > (ns dbns > (:require [clojure.java.jdbc :as jdbc] > [mysql/mysql-connector-java "5.1.38"])) > > ;(use 'clojure.java.jdbc) > > (println "Hello, World!") > > (let [ > db-host "localhost" > db-port 3306 > db-name "sidonie" > ] > > (def db { > :classname "com.mysql.jdbc.Driver" ; must be in classpath > :subprotocol "mysql" > :subname (str "//" db-host ":" db-port "/" db-name) > ; Any additional keys are passed to the driver > ; as driver-specific properties. > :user "mattei" > :password "sidonie2"})) > > ;(jdbc/query db ["SELECT * FROM Sigles"]) > > (jdbc/with-connection db > (jdbc/with-query-results rows > ["select * from Sigles"] > (println rows))) > > > ) > > > and now the error: > > [mattei@moita jclojure]$ lein run > Exception in thread "main" java.lang.RuntimeException: No such namespace: > jdbc, compiling:(jclojure/core.clj:37:3) > at clojure.lang.Compiler.analyze(Compiler.java:6688) > at clojure.lang.Compiler.analyze(Compiler.java:6625) > at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3766) > at clojure.lang.Compiler.analyzeSeq(Compiler.java:6870) > at clojure.lang.Compiler.analyze(Compiler.java:6669) > at clojure.lang.Compiler.analyze(Compiler.java:6625) > at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:6001) > at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5380) > at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3972) > at clojure.lang.Compiler.analyzeSeq(Compiler.java:6866) > at clojure.lang.Compiler.analyze(Compiler.java:6669) > at clojure.lang.Compiler.analyzeSeq(Compiler.java:6856) > at clojure.lang.Compiler.analyze(Compiler.java:6669) > at clojure.lang.Compiler.access$300(Compiler.java:38) > at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:589) > at clojure.lang.Compiler.analyzeSeq(Compiler.java:6868) > at clojure.lang.Compiler.analyze(Compiler.java:6669) > at clojure.lang.Compiler.analyze(Compiler.java:6625) > at clojure.lang.Compiler.eval(Compiler.java:6931) > at clojure.lang.Compiler.load(Compiler.java:7379) > at clojure.lang.RT.loadResourceScript(RT.java:372) > at clojure.lang.RT.loadResourceScript(RT.java:363) > at clojure.lang.RT.load(RT.java:453) > at clojure.lang.RT.load(RT.java:419) > at clojure.core$load$fn__5677.invoke(core.clj:5893) > at clojure.core$load.invokeStatic(core.clj:5892) > at clojure.core$load.doInvoke(core.clj:5876) > at clojure.lang.RestFn.invoke(RestFn.java:408) > at clojure.core$load_one.invokeStatic(core.clj:5697) > at clojure.core$load_one.invoke(core.clj:5692) > at clojure.core$load_lib$fn__5626.invoke(core.clj:5737) > at clojure.core$load_lib.invokeStatic(core.clj:5736) >
mysql and clojure
hello again, i tried dozen of web example about mysql and clojure but it doen't work, here is some of my code: for dependencies: (defproject jclojure "0.1.0-SNAPSHOT" :description "clojure JVM source code for Sidonie web interface administration" :url "https://sidonie.oca.eu; :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [ [org.clojure/clojure "1.8.0"] [mysql/mysql-connector-java "5.1.38"] [org.clojure/java.jdbc "0.7.3"] ] :main ^:skip-aot jclojure.core :target-path "target/%s" :profiles {:uberjar {:aot :all}}) the code (some of...): (ns jclojure.core (:gen-class)) (defn -main "I don't do a whole lot ... yet." [& args] ;(:require [clojure.java [jdbc :as sql]]) ;(require '[clojure.java.jdbc :as jdbc]) (ns dbns (:require [clojure.java.jdbc :as jdbc] [mysql/mysql-connector-java "5.1.38"])) ;(use 'clojure.java.jdbc) (println "Hello, World!") (let [ db-host "localhost" db-port 3306 db-name "sidonie" ] (def db { :classname "com.mysql.jdbc.Driver" ; must be in classpath :subprotocol "mysql" :subname (str "//" db-host ":" db-port "/" db-name) ; Any additional keys are passed to the driver ; as driver-specific properties. :user "mattei" :password "sidonie2"})) ;(jdbc/query db ["SELECT * FROM Sigles"]) (jdbc/with-connection db (jdbc/with-query-results rows ["select * from Sigles"] (println rows))) ) and now the error: [mattei@moita jclojure]$ lein run Exception in thread "main" java.lang.RuntimeException: No such namespace: jdbc, compiling:(jclojure/core.clj:37:3) at clojure.lang.Compiler.analyze(Compiler.java:6688) at clojure.lang.Compiler.analyze(Compiler.java:6625) at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3766) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6870) at clojure.lang.Compiler.analyze(Compiler.java:6669) at clojure.lang.Compiler.analyze(Compiler.java:6625) at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:6001) at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5380) at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3972) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6866) at clojure.lang.Compiler.analyze(Compiler.java:6669) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6856) at clojure.lang.Compiler.analyze(Compiler.java:6669) at clojure.lang.Compiler.access$300(Compiler.java:38) at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:589) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6868) at clojure.lang.Compiler.analyze(Compiler.java:6669) at clojure.lang.Compiler.analyze(Compiler.java:6625) at clojure.lang.Compiler.eval(Compiler.java:6931) at clojure.lang.Compiler.load(Compiler.java:7379) at clojure.lang.RT.loadResourceScript(RT.java:372) at clojure.lang.RT.loadResourceScript(RT.java:363) at clojure.lang.RT.load(RT.java:453) at clojure.lang.RT.load(RT.java:419) at clojure.core$load$fn__5677.invoke(core.clj:5893) at clojure.core$load.invokeStatic(core.clj:5892) at clojure.core$load.doInvoke(core.clj:5876) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invokeStatic(core.clj:5697) at clojure.core$load_one.invoke(core.clj:5692) at clojure.core$load_lib$fn__5626.invoke(core.clj:5737) at clojure.core$load_lib.invokeStatic(core.clj:5736) at clojure.core$load_lib.doInvoke(core.clj:5717) at clojure.lang.RestFn.applyTo(RestFn.java:142) at clojure.core$apply.invokeStatic(core.clj:648) at clojure.core$load_libs.invokeStatic(core.clj:5774) at clojure.core$load_libs.doInvoke(core.clj:5758) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invokeStatic(core.clj:648) at clojure.core$require.invokeStatic(core.clj:5796) at clojure.core$require.doInvoke(core.clj:5796) at clojure.lang.RestFn.invoke(RestFn.java:408) at user$eval5$fn__7.invoke(form-init7437695112761150837.clj:1) at user$eval5.invokeStatic(form-init7437695112761150837.clj:1) at user$eval5.invoke(form-init7437695112761150837.clj:1) at clojure.lang.Compiler.eval(Compiler.java:6927) at clojure.lang.Compiler.eval(Compiler.java:6917) at clojure.lang.Compiler.load(Compiler.java:7379) at clojure.lang
how to create dependncies for mysql in clojure
I want to access mysql. it is in c:\program files as mysql what is the rule to create a dependicy statement [mysql/mysql-connector-java 5.1.23]]. I have two books Practical Clojure Programming Clojure No answer in the books that I find -- -- 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.
Re: how to create dependncies for mysql in clojure
On Sunday, April 7, 2013 4:03:46 PM UTC-7, jayvan...@gmail.com wrote: I want to access mysql. it is in c:\program files as mysql what is the rule to create a dependicy statement [mysql/mysql-connector-java 5.1.23]]. I have two books Practical Clojure Programming Clojure No answer in the books that I find That looks right, what errors are you getting? -- -- 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.
Re: how to create dependncies for mysql in clojure
lein new mysql-test Edit mysql-test/project.clj to add: [mysql/mysql-connector-java 5.1.23] to the list of :dependencies You'll probably also want to add clojure.java.jdbc or another database library. For c.j.jdbc, add this dependency: [org.clojure/java.jdbc 0.3.0-alpha1] Your project.clj should look something like this: (defproject jtest 0.1.0-SNAPSHOT :description FIXME: write description :url http://example.com/FIXME; :license {:name Eclipse Public License :url http://www.eclipse.org/legal/epl-v10.html} :dependencies [[org.clojure/clojure 1.5.1] [org.clojure/java.jdbc 0.3.0-alpha1] [mysql/mysql-connector-java 5.1.23]]) Start a REPL in that project folder. In the REPL, require the java.jdbc namespaces and start working against your database: (require '[clojure.java.jdbc :as j] '[clojure.java.jdbc.sql :as s]) Use the examples in the java.jdbc documentation to help you along: https://github.com/clojure/java.jdbc/tree/master/doc/clojure/java/jdbc Sean On Sun, Apr 7, 2013 at 4:03 PM, jayvandal...@gmail.com wrote: I want to access mysql. it is in c:\program files as mysql what is the rule to create a dependicy statement [mysql/mysql-connector-java 5.1.23]]. I have two books Practical Clojure Programming Clojure No answer in the books that I find -- -- 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. -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- -- 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.