MySQL Forums
Forum List  »  Stored Procedures

Re: weird error in my JDBC code
Posted by: scott
Date: October 15, 2005 06:39PM

that does not work at all. If I remove the CALL key word, the program fails at the prepareCall() method call, if I don't it fails at the execute() method call.

so, this is the full java class:

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Types;

public class MysqlTest
{
public static void main(String[] args) throws Exception
{

DriverManager.registerDriver( new com.mysql.jdbc.Driver());
Connection m_conn = DriverManager.getConnection ("jdbc:mysql://localhost/survey","survey","survey");
m_conn.setAutoCommit(false);

String l_initUserSQL = "call init(?, ?);";

CallableStatement l_cstmt = m_conn.prepareCall(l_initUserSQL);

l_cstmt.setString(1,"jirUser");


l_cstmt.registerOutParameter(2,Types.INTEGER);

try
{
l_cstmt.execute();
}
catch(SQLException e)
{
e.printStackTrace();
}

}
}

and this is the stored procedure:

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


anything I am doing wrong here? Or this is just a very basic bug in MYSQL code?

Options: ReplyQuote


Subject
Views
Written By
Posted
3093
October 12, 2005 07:04PM
1989
October 13, 2005 03:32PM
Re: weird error in my JDBC code
2059
October 15, 2005 06:39PM
2016
October 16, 2005 01:07AM
1869
October 16, 2005 09:32AM
1990
October 16, 2005 06:06PM
1920
October 17, 2005 07:19PM
1895
October 18, 2005 05:47PM
1965
October 18, 2005 07:42PM
1959
October 19, 2005 01:56AM
1901
October 19, 2005 01:55AM
1916
October 19, 2005 07:01AM
1961
October 19, 2005 07:04AM
1851
October 19, 2005 08:54PM
1856
October 20, 2005 01:16AM


Sorry, you can't reply to this topic. It has been closed.

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.