开发者

Unsupported SQL Type 1111 when passing String to a VARCHAR field

开发者 https://www.devze.com 2022-12-14 22:30 出处:网络
I have been smashing my head against this for a while now. I am using iBatis with my JAVA code to run Stored Proc residing in Sybase DB.

I have been smashing my head against this for a while now.

I am using iBatis with my JAVA code to run Stored Proc residing in Sybase DB.

Stored procedure is expecting some parameters. few of them are declared as VARCHAR (6)

So in my iBatis mapping i did the following for those parameters.

<parameter property="searchUserId" jdbcType="String" javaType="java.lang.String" mode="IN"/>

However, when I do this I get the following error.

--- Check the statement (update procedure failed).  
--- Cause: java.sql.SQLException: JZ006: Caught IOException: java.io.IOException: JZ0SL: Unsupported SQL type 1111.
Caused by: java.sql.SQLException: JZ006: Caught IOException: java.io.IOException: JZ0SL: Unsupported SQL type 1111.

So I changed my mapping to following:

<parameter property="searchUserId" jdbcType="VARCHAR" javaType="java.lang.String" mode="IN"/>

which got rid of the error above, however, now the parameter searchUserId is getting value 开发者_高级运维of null passed into the SP. I know for sure that from my java code I am NOT passing null.

Has someone faced this issue? what should I change my mapping to??


I ran into this problem for a different reason: The table had a geometry (PostGIS extension) column in it that I guess the driver couldn't parse. Dropping that column made it work.


Your parameter element looks ok, after the change to use VARCHAR as jdbcType. Could you include the rest of the parameter element and the procedure element from the mapping file, and the code that creates the parameter map and calls the query?

It could be something simple like a typo when constructing the map passed into the query (at least that's the kind of mistake I would make -- I know I've been inconsistent about capitalizing "userId" while using Ibatis).


I too faced a similar situation. After searching a lot, finally I found that answer to my problem was that I was missing a particular 'key' while constructing map. I was missing a statement:

map.put("job_name", job.getJobName());

& I was using JOB_NAME=#{job_name} in CronMapper.xml

Also some where else I was using JOB_NAME=#{jobName}

0

精彩评论

暂无评论...
验证码 换一张
取 消