我正在通过 ibatis 调用存储过程。当使用 jconn2.jar (5.5) 时,它可以工作,而且已经工作了。当我将其替换为 jtds jar (1.2.5) 时,出现异常“无效的 SQL 语句或 JDBC 转义,未找到终止 '}'”。
为了提高透明度,我将 Spring 与 DBCP 结合使用。显然,jTDS 中 SQL 代码的解析不受欢迎,而 jconn2 中则接受了这一点。这个项目早于我们很多人,而且我已经很多年没有使用 Sybase 了。
数据中的外围字符是“-”、“:”和“.”。
我是否需要转义存储过程调用语句中的参数来解决此问题? jconn2 是否有未针对 jTDS 设置的默认设置?
谢谢。
I'm calling a stored procedure via ibatis. It works, and has worked, when using the jconn2.jar (5.5). When I swap it out for the jtds jar (1.2.5) I get an exception "Invalid SQL statement or JDBC escape, terminating '}' not found."
For more transparency I'm using Spring with DBCP. Obviously the parsing of the SQL code in jTDS is not being liked, that is being accepted in jconn2. This project predates a bunch of us, and I haven't used Sybase in years.
The outlying chars in the data are "-", ":" and "."
Do I need to escape my parameters in the stored procedure call statement to get around this issue? Are there default settings for jconn2 that are not set for jTDS?
Thanks.
发布评论
评论(1)
答案是 jConnect 松散地解释大括号和圆括号的顺序。
因此,{call MyStoredProc(?,?,?}) 对于 jConnect 来说没问题。 jTds 具有严格的解析,因此不匹配的大括号和括号是不正确的。
不好玩。
The answer is jConnect loosely interprets the ordering of braces and parentheses.
So {call MyStoredProc(?,?,?}) is fine for jConnect. jTds has strict parsing, so the mis-matched brace and parenthesis is incorrect.
Not fun.