ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Butler <jeffgbut...@gmail.com>
Subject Re: Error while trying to call stored proc from ibatis
Date Thu, 18 Jun 2009 16:04:16 GMT
This looks like an exception raised by the DB.  My guess is that the SP
doesn't really have three parameters.  Maybe it should be this:

{? = call sample_stored_proc(?,?)}
(just a guess)

Jeff Butler



On Thu, Jun 18, 2009 at 8:43 AM, aravind.s <aravind.s@cgi.com> wrote:

>  *Hi,*
>
> * *
>
> *Am trying to call a stored procedure from ibatis.*
>
>
>
>
>
> *SqlMap.xml*
>
> * *
>
> <parameterMap id="parameterId" class="Sample">
>
>             <parameter property="id" jdbcType="VARCHAR" javaType="java.lang.String"
> mode="IN" />
>
>             <parameter property="name" jdbcType="VARCHAR" javaType="java.lang.String"
> mode="IN" />
>
>             <parameter property="result" jdbcType="VARCHAR" javaType="java.lang.String"
> mode="OUT" />
>
> </parameterMap>
>
>
>
>
>
>       <procedure id="sampleProc" parameterMap="parameterId">
>
>       {call sample_stored_proc(?,?,?)}</procedure>
>
>
>
> *Java Class*
>
>
>
> Sample sample = *new* Sample();
>
>             sample.setId( "111" );
>
>             sample.setName ( "name1" );
>
>             sample.setResult("" );
>
>             (String)getSqlMapClientTemplate().queryForObject( "sampleProc",
> sample );
>
> * *
>
> *Am getting the below exception.*
>
> *Any idea where am going wrong?*
>
>
>
>
>
> org.springframework.jdbc.BadSqlGrammarException: SqlMapClient operation;
> bad SQL grammar []; nested exception is
> com.ibatis.common.jdbc.exception.NestedSQLException:
>
> --- The error occurred in SqlMap.xml.
>
> --- The error occurred while applying a parameter map.
>
> --- Check the parameterId.
>
> --- Check the statement (update procedure failed).
>
> --- Cause: java.sql.SQLException: The number of parameter values set or
> registered does not match the number of parameters.
>
>             at
> org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:97)
>
>             at
> org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
>
>             at
> org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
>
>             at
> org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
>
>             at
> org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:212)
>
>             at
> org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:271)
>
>
>
>
>
>
>
> Thanks In Advance,
>
> *Aravind. S*
>
>
>

Mime
View raw message