乐者为王

Do one thing, and do it well.

com.sybase.jdbc.SybSQLException: The parameter '@user' in the procedure 'sp_adm_chk_lvl' was not declared as an OUTPUT parameter

运行环境:WebLogic 8.16 + Sybase ASE 12.5

问题:The New, Save from File menu are grayed out

分析打印出来的日志文件找到有以下异常出现:

1
2
3
4
5
org.springframework.jdbc.UncategorizedSQLException: CallableStatementCallback
    ; uncategorized SQLException for SQL [{? = call sp_adm_chk_lvl(?, ?, ?, ?, ?, ?, ?)}]
    ; SQL state [ZZZZZ]; error code [276]
    ; The parameter '@user' in the procedure 'sp_adm_chk_lvl' was not declared as an OUTPUT parameter.
    ; nested exception is com.sybase.jdbc.SybSQLException: The parameter '@user' in the procedure 'sp_adm_chk_lvl' was not declared as an OUTPUT parameter.

搜索到一篇出现类似问题的文章 http://www.ibm.com/support/docview.wss?uid=swg21174150 ,其中有这么一段文字:

1
2
3
4
If you call CallableStatement.clearParameters() when the statement has a ?=rpc return value,
we forget that there is a return value and the next time the rpc is executed we send too many
input parameters, and they are all shifted to the right. This problem has been corrected,
and jConnect now has the expected behavior for the clearParameters() method.

因此猜测菜单变灰的问题是由于使用了不正确的JDBC Driver版本。在Weblogic Console发现Connection Pools中Driver Name是com.sybase.jdbc.SybDriver,而正确的设置应该是com.sybase.jdbc2.jdbc.SybDriver,修改Driver Name后New, Save菜单项果然可以正常使用了。

Comments