<p>I am trying to execute some stored procedures in groovy way.  I am able to do it quite easily by using straight JDBC but this does not seem in the spirit of Grails.</p>

<p>I am trying to call the stored procedure as:</p>

<pre><code>sql.query( "{call web_GetCityStateByZip(?,?,?,?,?)}",[params.postalcode, 
sql.out(java.sql.Types.VARCHAR), sql.out(java.sql.Types.VARCHAR), 
sql.out(java.sql.Types.INTEGER), sql.out(java.sql.Types.VARCHAR)]) { rs -&gt;
   params.city = rs.getString(2)
   params.state = rs.getString(3)
}
</code></pre>

<p>I tried various ways like <code>sql.call</code>. I was trying to get output variable value after this.</p>

<p>Everytime error:</p>

<pre><code>Message: Cannot register out parameter. 
Caused by: java.sql.SQLException: Cannot register out parameter. 
Class: SessionExpirationFilter 
</code></pre>

<p>but this does not seem to work.</p>

<p>Can anyone point me in the right direction?</p>

This is still unanswered, so I did a bit of digging although I don't fully understand the problem. The following turned up from the Groovy source, perhaps it's of some help:
This line seems to be the origin of the exception:
http://groovy.codehaus.org/xref/groovy/sql/Sql.html#1173
This would seem to indicate that you have a Statement object implementing PreparedStatement, when you need the subinterface CallableStatement, which has the registerOutParameter() method which should be ultimately invoked.