<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged sql</title>
<link>https://ask.clojure.org/index.php/tag/sql</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>Why i get the &quot;Could not locate hugsql/core__init.class, hugsql/core.clj or hugsql/core.cljc on classpath.&quot; ?</title>
<link>https://ask.clojure.org/index.php/12240/could-locate-hugsql-coreinit-class-hugsql-hugsql-classpath</link>
<description>&lt;p&gt;It's happen when i load the huqsql namespace into nREPL and then the error is appears to be something like this :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Syntax error (FileNotFoundException) compiling at (src/db_examples/hugsql.clj:1:1).
Could not locate hugsql/core__init.class, hugsql/core.clj or hugsql/core.cljc on classpath.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;dependencies :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[[org.clojure/clojure &quot;1.10.1&quot;]
             [seancorfield/next.jdbc &quot;1.1.613&quot;]
             [org.postgresql/postgresql &quot;42.2.8&quot;]
             [com.layerware/hugsql &quot;0.5.3&quot;]
             [hugsql-next-jdbc &quot;0.1.3&quot;]]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;the namespace :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(ns db-examples.hugsql

(:require [db-examples.core :refer [db]]
            [next.jdbc :as jdbc]
            [hugsql.core :as hugsql]))

(hugsql/def-db-fns &quot;resources/users.sql&quot;)
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12240/could-locate-hugsql-coreinit-class-hugsql-hugsql-classpath</guid>
<pubDate>Mon, 26 Sep 2022 16:46:09 +0000</pubDate>
</item>
<item>
<title>set the query timeout on a SQL query</title>
<link>https://ask.clojure.org/index.php/9105/set-the-query-timeout-on-a-sql-query</link>
<description>&lt;p&gt;We have a SQL query that runs for 300 seconds sometimes.  This slows down everything, and we would prefer to stop and throw an error after 30 seconds. &lt;/p&gt;
&lt;p&gt;In Java, there is a Statement.setQueryTimeout() function where we can set the timeout to 30 seconds. &lt;/p&gt;
&lt;p&gt;What is the best way to set this with our CLojure system?  &lt;/p&gt;
&lt;p&gt;FYI: We are also using honeysql.&lt;/p&gt;
</description>
<category>IO</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/9105/set-the-query-timeout-on-a-sql-query</guid>
<pubDate>Wed, 19 Feb 2020 21:13:46 +0000</pubDate>
</item>
<item>
<title>How do you approach data (database) modeling in Clojure?</title>
<link>https://ask.clojure.org/index.php/8484/how-do-you-approach-data-database-modeling-in-clojure</link>
<description>&lt;p&gt;Hello everyone! &lt;/p&gt;
&lt;p&gt;Recently i decided to create a copy of a moderate-sized project (which is written in Java with Spring Boot and Hibernate) in Clojure. And i wonder how to model data, and models, and relations in Clojure in idiomatic way?&lt;/p&gt;
&lt;p&gt; I don't think it necessarily  should be &lt;em&gt;objects&lt;/em&gt; or ORM, but i do think that there should be some kind of a schema of DB or data spec reflected in code (so a developer can know what to query from database and what to expect to come from that query). &lt;/p&gt;
&lt;p&gt;So, what my options are?&lt;/p&gt;
&lt;p&gt;EDIT: As for now, database is PostgeSQL&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
&lt;p&gt;EDIT2: Thank you all for your answers, they are very helpful and i definitely able to solve my problem now!&lt;/p&gt;
</description>
<category>Tools</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/8484/how-do-you-approach-data-database-modeling-in-clojure</guid>
<pubDate>Thu, 29 Aug 2019 07:21:08 +0000</pubDate>
</item>
</channel>
</rss>