<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged next.jdbc</title>
<link>https://ask.clojure.org/index.php/tag/next.jdbc</link>
<description></description>
<item>
<title>Why i get &quot;No suitable driver found for jdbc:://127.0.0.1/&quot; ?</title>
<link>https://ask.clojure.org/index.php/12247/why-i-get-no-suitable-driver-found-for-jdbc-127-0-0-1</link>
<description>&lt;p&gt;Java version :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;openjdk 18.0.2-ea 2022-07-19
OpenJDK Runtime Environment (build 18.0.2-ea+9-Ubuntu-222.04)
OpenJDK 64-Bit Server VM (build 18.0.2-ea+9-Ubuntu-222.04, mixed mode, sharing)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;but when i start the nREPL in my text editor, it's says :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Starting nREPL server...
/usr/lib/jvm/java-11-openjdk-amd64/bin/java ...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Dependencies :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;:dependencies [[org.clojure/clojure &quot;1.11.1&quot;]
               [com.github.seancorfield/next.jdbc &quot;1.3.834&quot;]
               [org.postgresql/postgresql &quot;42.5.0&quot;]
               [com.layerware/hugsql &quot;0.5.3&quot;]]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;code :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(def db
    {:classname &quot;org.postgresql.Driver&quot;
     :subprotocol &quot;postgresql&quot;
     :subname &quot;reporting&quot;
     :user &quot;admin&quot;
     :password &quot;admin&quot;})

(defn add-user-transaction [users]
  (jdbc/with-transaction [t-conn db]
                         (if-not (find-user t-conn {:id (:id users)})
                           (add-user! t-conn users))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Everything works normal with that configuration, but only when i evaluate&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(add-user-transaction {:id &quot;cheryl&quot;
                   :pass &quot;Cheryl&quot;})
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt; the error appears.&lt;/p&gt;
&lt;p&gt;It's asked in &lt;a rel=&quot;nofollow&quot; href=&quot;https://stackoverflow.com/questions/73521391/clojure-execution-error-sqlexception-at-java-sql-drivermanager-getconnection&quot;&gt;Clojure: Execution error (SQLException) at java.sql.DriverManager/getConnection (DriverManager.java:702)&lt;/a&gt; and already have answered, but the only answer in there is using &lt;code&gt;:deps&lt;/code&gt; or &lt;code&gt;deps.edn&lt;/code&gt; (as far i know, this is Maven repository), so how about leiningen? Or did i miss something about leiningen and Maven?&lt;br&gt;
And i even restarting my pc, text editor, and nREPL but nothing change.&lt;/p&gt;
</description>
<category>Errors</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12247/why-i-get-no-suitable-driver-found-for-jdbc-127-0-0-1</guid>
<pubDate>Mon, 26 Sep 2022 21:45:00 +0000</pubDate>
</item>
<item>
<title>Next.jdbc plan row realization</title>
<link>https://ask.clojure.org/index.php/9120/next-jdbc-plan-row-realization</link>
<description>&lt;p&gt;What is the prefered way to realize row from the result of &lt;code&gt;next.jdbc/plan&lt;/code&gt; as is, without any transformation?&lt;/p&gt;
&lt;p&gt;Identity doesn't work:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(require '[next.jdbc :as jdbc])

(def sql-params
  [&quot;SELECT column1
      FROM (VALUES (1, 1, 1),
                   (2, 2, 2),
                   (3, 3, 3)) AS _&quot;])

(into []
      (map identity)
      (jdbc/plan db-spec
                 sql-params))
;=&amp;gt; [{row} from `plan` -- missing `map` or `reduce`?
;    {row} from `plan` -- missing `map` or `reduce`?
;    {row} from `plan` -- missing `map` or `reduce`?]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If rows are represented as maps (default), &lt;code&gt;#(into {} %)&lt;/code&gt; works:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(into []
      (map #(into {} %))
      (jdbc/plan db-spec
                 sql-params))
;=&amp;gt; [{:column1 1} {:column1 2} {:column1 3}]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If rows are represented as vectors (&lt;code&gt;builder-fn&lt;/code&gt;), &lt;code&gt;vec&lt;/code&gt; can be used:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(require '[next.jdbc.result-set :as rs])

(into []
      (map vec)
      (jdbc/plan db-spec
                 sql-params
                 {:builder-fn rs/as-arrays}))
;=&amp;gt; [[1] [2] [3]]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Is there any xform that would cover both map and vector row realization?&lt;/p&gt;
&lt;p&gt;Or should I use something other than &lt;code&gt;plan&lt;/code&gt; for lazy result set reading?&lt;/p&gt;
</description>
<category>Libs</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/9120/next-jdbc-plan-row-realization</guid>
<pubDate>Wed, 26 Feb 2020 02:34:42 +0000</pubDate>
</item>
</channel>
</rss>