从mysql中检索参数时出错

时间:2016-09-01 04:08:56

标签: mysql servlets

当我试图从我的servlet中的mysql存储过程中检索出参数时,我收到了此消息。你能帮我解决一下吗,谢谢。

错误讯息:

Error found: Exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '`pIsValid`,@com_mysql_jdbc_outparam_`pMessage`)' at line 1

我的存储过程:

CREATE PROCEDURE `m_test`(OUT `pIsValid` VARCHAR(50), OUT `pMessage` VARCHAR(50))
LANGUAGE SQL
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT ''
BEGIN
SET pIsValid := 'NO';
set pMessage := 'Hai there';
END

我的Servlet调用程序:

strQuery = "{call m_test(?,?)}";
    cs = conMain.prepareCall(strQuery);
cs.registerOutParameter(1, Types.VARCHAR);
    cs.registerOutParameter(1, Types.VARCHAR);

    cs.execute();
    isValid = cs.getString(1);
    strAlert = cs.getString(2);

0 个答案:

没有答案