Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Labels:
      None

      Description

      Useful for stored procedure results:

      call_proc.clj
          (defn call-stored-proc [connection]
            (jdbc/query
              (myapp.db/connection)
              ["{call someProc()}"]
              :as-arrays? true))
      

      Java code to handle multiple result sets:

      MultiResults.java
          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
                     }
                     rs.close();
          
                  //Check for next result set
                  results = stmt.getMoreResults();
                } 
                stmt.close();
             }
             catch (Exception e) {
                e.printStackTrace();
             }
          }
      

        Attachments

          Activity

            People

            • Assignee:
              seancorfield Sean Corfield
              Reporter:
              seancorfield Sean Corfield
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: