MySQL Forums
Forum List  »  Stored Procedures

weird error in my JDBC code
Posted by: scott
Date: October 12, 2005 07:04PM

Hi,

I am trying to learn how to invoke mysql stored procedures from Java.

So, I have a stored procedure as follows:

CREATE PROCEDURE `init`(IN `sName` VARCHAR(192), OUT `sId` INTEGER)
BEGIN
set sId= 30;
END

I am using the following java code to invoke the stored procedure:

//get the connection, then
CallableStatement cstmt = (CallableStatement) m_conn.prepareCall("call init(?, ?);");
cstmt.setString(1,m_BIuser.getName());
cstmt.registerOutParameter(2,Types.INTEGER);
cstmt.execute();

However, the above code throws the follwoing exception at the cstmt.execute() line:

java.sql.SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sId`)' at line 1

The 'init' stored procedure does not have any syntax error since I can compile and execute it from within MYSQL Maestro. What am I doing wrong here? Is this a bug?

I am using the mysql 5.0 release canditate and the latest mysql JDBC driver.

thanks

scott

Options: ReplyQuote


Subject
Views
Written By
Posted
weird error in my JDBC code
2874
October 12, 2005 07:04PM
1888
October 13, 2005 03:32PM
1949
October 15, 2005 06:39PM
1915
October 16, 2005 01:07AM
1771
October 16, 2005 09:32AM
1894
October 16, 2005 06:06PM
1828
October 17, 2005 07:19PM
1801
October 18, 2005 05:47PM
1859
October 18, 2005 07:42PM
1847
October 19, 2005 01:56AM
1794
October 19, 2005 01:55AM
1813
October 19, 2005 07:01AM
1862
October 19, 2005 07:04AM
1756
October 19, 2005 08:54PM
1772
October 20, 2005 01:16AM


Sorry, you can't reply to this topic. It has been closed.
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.