Announcement Announcement Module
No announcement yet.
Help! Access Result set via a Stored Procedure Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help! Access Result set via a Stored Procedure


    I'm trying to get (and use the data within) a result set by calling a stored procedure on a Sql server Database.

    I'm a trying:

    def sql = Sql.newInstance("jdbc:sqlserver://localhost;user=user;password=password;databaseName =DBname;", "" )

    sql.query("{call up_Monitor_QueueInfo(?,?)}", [null, null]){ resultSet ->
    resultSet.each{ rs->
    println rs

    However this doesn't seem to be returning me a resultSet that I can iterate over.

    What is the best way of calling a stored proc and then handling the output?

    (I have also tried:

    def params = [null, null]

    def resSet = sql.executeQuery("up_Monitor_QueueInfo(?,?)", params)

    but this gives me this error:

    31-Aug-2011 11:01:26 org.codehaus.groovy.runtime.StackTraceUtils sanitize

    WARNING: Sanitizing stacktrace:

    groovy.lang.MissingMethodException: No signature of method: groovy.sql.Sql.executeQuery() is applicable for argument types: (java.lang.String, java.util.ArrayList) values: [up_Monitor_QueueInfo(?,?), [null, null]]
    Possible solutions: executeInsert(java.lang.String), executeInsert(java.lang.String, [Ljava.lang.Object, executeInsert(java.lang.String, java.util.List)


    Thanks in advance