You should :require the namespaces, not try to :import things.

(ns your.namespace
  (:require [next.jdbc :as jdbc]))

I suggest you start off by working through
https://cljdoc.org/d/seancorfield/next.jdbc/1.0.9/doc/getting-started

The ds binding that you have will satisfy this check (instance?
javax.sql.DataSource ds) -- because it is an instance of that Java
interface.

It sounds like you have quite a few misconceptions about using the library
(and perhaps using Clojure in general?) so I highly recommend joining the
Clojurians Slack http://clojurians.net and https://clojurians.slack.com
where you can ask real time questions in the #beginners channel and
next.jdbc-specific questions in the #sql channel.



On Thu, Oct 17, 2019 at 6:03 PM Laws <smashcompan...@gmail.com> wrote:

> If I do this:
>
> (class ds)
>
> I see:
>
> next.jdbc.connection$url_PLUS_etc$reify__555
>
> Is there anyway I can match against this? I'd like a runtime check to know
> that the code really does have a database connection. Imagine code like
> this:
>
> (if (= next.jdbc.connection (class ds))
>       (println "its next.jdbc.connection")
>       (println "fail, it is not next.jdbc.connection"))
>
> I get errors such as:
>
> java.lang.ClassNotFoundException: seancorfield/next.jdbc.Connection,
> compiling:(core.clj:1:1)
>
> The namespace is here:
>
>
> https://github.com/seancorfield/next-jdbc/blob/master/src/next/jdbc/connection.clj
>
>
>    (:import
>    [seancorfield/next.jdbc Connection]
>    )
>
>    (:import
>    [next.jdbc Connection]
>    )
>
>    (:import
>    [next.jdbc.connection]
>    )
>
>
> What is the correct way to do this?
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/clojure/8a486bd5-bb5f-41ef-bcb6-74e49ed58db4%40googlegroups.com
> <https://groups.google.com/d/msgid/clojure/8a486bd5-bb5f-41ef-bcb6-74e49ed58db4%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles Networks, LLC. -- https://worldsinglesnetworks.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/CAD4thx_%3DcAMUWv0K%3D_Z1JhEP%2B%2Bh1OR4Bv0g6sgnguz_LCvnGBw%40mail.gmail.com.

Reply via email to