Parenthesis call the thing they wrap as a function. You have getConnection 
wrapped in a redundant set of parenthesis, so the return value of 
getConnection is being called. It is not a function, but it is a 
ConnectionCustom, so you get your error.

Some hints to make clojure code more readable:

classes should be CamelCase, methods should be camelCase, functions should 
be kabob-case.

parens should be separated by a preceding item by a space - (f (g x)) - g 
and x are not args to f, (g x) is the arg to f

no line should contain only parens

On Friday, December 6, 2013 5:08:23 AM UTC-8, Avinash Dongre wrote:
>
> Hi
> I have our own jdbc driver when I am trying to use clojure java.jdbc it is 
> giving me error like below
>
> Exception in thread "main" java.lang.ClassCastException: 
> a.b.my_custom_driver cannot be cast to clojure.lang.IFn
> at clojure.gemfireXD.jdbc$createStatement.invoke(client.clj:13)
> at clojure.gemfireXD.jdbc$eval13.invoke(client.clj:18)
> at clojure.lang.Compiler.eval(Compiler.java:6619)
> at clojure.lang.Compiler.load(Compiler.java:7064)
> at clojure.lang.Compiler.loadFile(Compiler.java:7020)
> at clojure.main$load_script.invoke(main.clj:294)
> at clojure.main$script_opt.invoke(main.clj:356)
> at clojure.main$main.doInvoke(main.clj:440)
> at clojure.lang.RestFn.invoke(RestFn.java:408)
> at clojure.lang.Var.invoke(Var.java:415)
> at clojure.lang.AFn.applyToHelper(AFn.java:161)
> at clojure.lang.Var.applyTo(Var.java:532)
> at clojure.main.main(main.java:37)
>
>
> When I tried following 
>
>
>
> (ns clojure.custom.jdbc
>   (:import [java.sql Connection DriverManager])
>   (:require [clojure.string :as clojure-string]))
>
> (defn getConnecton
>   [url]
>   (clojure.lang.RT/loadClassForName "custom.url.ClientDriver") 
>   (DriverManager/getConnection url))
>
> (defn createStatement
>   [db]
>   (^Statement (.createStatement db)
>   ))
>   
>
> (createStatement((getConnecton "jdbc:mydbServer://localhost:1527/")))
>
> Exception in thread "main" java.lang.ClassCastException: 
> my.custom.implementation.internal.ConnectionCustom cannot be cast to 
> clojure.lang.IFn
> at clojure.gemfireXD.jdbc$eval13.invoke(client.clj:16)
> at clojure.lang.Compiler.eval(Compiler.java:6619)
> at clojure.lang.Compiler.load(Compiler.java:7064)
> at clojure.lang.Compiler.loadFile(Compiler.java:7020)
> at clojure.main$load_script.invoke(main.clj:294)
> at clojure.main$script_opt.invoke(main.clj:356)
> at clojure.main$main.doInvoke(main.clj:440)
> at clojure.lang.RestFn.invoke(RestFn.java:408)
> at clojure.lang.Var.invoke(Var.java:415)
> at clojure.lang.AFn.applyToHelper(AFn.java:161)
> at clojure.lang.Var.applyTo(Var.java:532)
> at clojure.main.main(main.java:37)
>
>
> What I am missing here.
>

-- 
-- 
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