<< Back to previous view

[JDBC-64] Support multiple result sets? Created: 03/Jul/13  Updated: 30/Jun/17

Status: Open
Project: java.jdbc
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Major
Reporter: Sean Corfield Assignee: Sean Corfield
Resolution: Unresolved Votes: 0
Labels: None


Useful for stored procedure results:

(defn call-stored-proc [connection]
        ["{call someProc()}"]
        :as-arrays? true))

Java code to handle multiple result sets:

public static void executeProcedure(Connection con) {
       try {
          CallableStatement stmt = con.prepareCall(...);
          .....  //Set call parameters, if you have IN,OUT, or IN/OUT parameters
          boolean results = stmt.execute();
          int rsCount = 0;
          //Loop through the available result sets.
         while (results) {
               ResultSet rs = stmt.getResultSet();
               //Retrieve data from the result set.
               while (rs.next()) {
                ....// using rs.getxxx() method to retieve data
            //Check for next result set
            results = stmt.getMoreResults();
       catch (Exception e) {

Comment by Sean Corfield [ 15/Sep/13 4:20 PM ]

Post 0.3.0, ideally after adding stored proc support properly (see JDBC-48).

Comment by Kyle Cordes [ 15/Sep/13 9:45 PM ]

With or without SPs, this would be an excellent addition; with some RDBMSs, use of compound statement (or SPs) with multiple result sets is relatively common.

Comment by Sean Corfield [ 02/Apr/14 6:07 PM ]

Discussion with Pieter Laeremans:

Sean: My thinking is that I would add :multi-result? to execute! and query and then arrange for them to return sequences of result sets. Unraveling the calls so multi-result? can work cleanly inside those functions would be the hard part

Pieter: That sounds fine by me. But there's something a bit more subtle I guess,
Now you can pass a function row-fn to transform rows, in the multi-resultset case it would perhaps be more appropriate
to pass on a seq of row-fns, so that a different function can be used on different rows.

Comment by Alexey Naumov [ 15/Dec/14 2:39 PM ]

Any updates on the issue?

Comment by Sean Corfield [ 15/Dec/14 2:58 PM ]

No update yet. No one has submitted a patch and I've been too busy to look at this in detail.

Comment by Sean Corfield [ 30/Jun/17 6:41 PM ]

Note: any patch for this now needs to take into account the reducible version of the result set as well as the regular version.

Generated at Sat Jan 20 15:27:44 CST 2018 using JIRA 4.4#649-r158309.