Fork me on GitHub

Hi I am new to Clojure as well as SQL, so pretty much stumbling around in the dark. What I want to do is execute a stored procedure on MS SQL Server. I can do this successfully in Java:

// Create a variable for the connection string.
        String connectionUrl = "jdbc:" +

        // Declare the JDBC objects.
        Connection con = null;
        Statement stmt = null;
        ResultSet rs = null;

        try {
            // Establish the connection.
            con = DriverManager.getConnection(connectionUrl);

            // Create and execute an SQL statement that returns some data.
            String SQL = "pc_ListMyTimeseriesObservations  @TimeseriesCodes='EACM003A,EACM003A',  @StartDate=' ', @EndDate=' '";
            stmt = con.createStatement();
            rs = stmt.executeQuery(SQL);

            // Iterate through the data in the result set and display it.
            while ( {
                System.out.println(rs.getString(4) + " " + rs.getString(5));
But I get an error in Clojure: A result set was generated for update.
(ns jdbc-test.core
  (:require [ :as j]))

(def tsa-sarb
  {:connection-uri (str "jdbc:"

(j/db-do-prepared tsa-sarb (str "EXEC pc_ListMyTimeseriesObservations "
                                "@TimeseriesCodes='EACM003A,EACM004A', "
                                "@StartDate=' ', @EndDate=' ' "))


@byrongibby Try sing j/query instead of j/db-do-prepared (although support for stored procedures is a bit limited right now in


@venantius Nice to see Korma is being worked on again -- can you provide some background on how and why it has been resurrected?


@seancorfield I use it in a fair number of projects and was alarmed that it didn’t seem to be getting enough maintenance resources.


Do you use the ORM-like features of it?


@venantius fyi I'm also working on a brand new clojure library for sql


It just needs some more doc now


I would not expect Korma to start moving “full speed ahead” again. But over the last 18 months people have merged a number of bugfixes and done work to refactor the internal engine, and I wanted to make sure that work didn’t end up in vain


I’m not speaking for the rest of the maintainers, here. I’m just helping out a bit to provide the project with a bit of boost since it’s still in use by a lot of people


Due to the lack of maintenance (and the ORM-like nature of it), many folks in the Clojure world tend to warn folks to stay away from Korma. It'll be interesting to see how that shifts now it's getting regularly maintained again.


(even if it's not "full speed" 🙂 )


@venantius Any thoughts on upgrading Korma to 0.7.x releases?


@seancorfield although i can understand that ORM features are not what people want in a language like clojure, i’m actually a little surprised that there isn’t more use of the language to help automate some of what i consider tedious aspects of dealing with sql. am i wrong to say that the “standard” approach is to deal with DDL out of band and write queries by hand or with a query builder?


You are pretty much correct @lee.justin.m -- I recommend HoneySQL as a query builder (I started to write my own and integrate it into java.jdbc but community feedback was to keep that concern separate from the core library -- so I just dropped that idea since HoneySQL was well-maintained).


I think Korma is the only thing out there that tries to manage key relationships in query/update operations?


i just can’t get over how weird that is when you have the best metaprogramming tool right there


@seancorfield that sounds great to me 🙂