I have set up a new MySql database and defined a test stored procedure. I can call stored procedures that take no parameters, but if I call one that takes at least one parameter I get an index exception.
The exception I receive is the following:
The stored procedure looks like:
Additional info:
1) Installed using xampp
2) Using MySql 5.5
More Info
-----------
I noticed that if I go into MySql Admin and look at the stored procedures as 'root' everything is fine. But if I log in as 'webuser' I cannot see the body of the stored procedures. I have assigned ALL privileges to the user, but he still cannot see the body. I exported the database and changed the creator to 'webuser' restored the database and still could not see the procedure body as 'webuser'.
Yet More info
-------------
I have removed the calls to the stored procedures and put the SQL directly in my code and I still get the same error message.
Connection c = connector.getConnection(); CallableStatement cs = c.prepareCall("{ call fms.OneParam(?)}"); cs.registerOutParameter(1, java.sql.Types.INTEGER); cs.execute(); <== FAILS WITH SQLException int param1 = cs.getInt(1); return param1;
The exception I receive is the following:
java.sql.SQLException Parameter index of 1 is out of range (1, 0)
The stored procedure looks like:
CREATE DEFINER=`root`@`localhost` PROCEDURE `OneParam`( OUT ecode INT) BEGIN SET ecode = 5; ENDAnd the user I am connecting with has execute permissions on the stored procedures.
Additional info:
1) Installed using xampp
2) Using MySql 5.5
More Info
-----------
I noticed that if I go into MySql Admin and look at the stored procedures as 'root' everything is fine. But if I log in as 'webuser' I cannot see the body of the stored procedures. I have assigned ALL privileges to the user, but he still cannot see the body. I exported the database and changed the creator to 'webuser' restored the database and still could not see the procedure body as 'webuser'.
Yet More info
-------------
I have removed the calls to the stored procedures and put the SQL directly in my code and I still get the same error message.
Connection c = null; PreparedStatement ps = null; try { c = connector.getConnection(); ps = c.prepareStatement(INSERT_USER_REC); ps.setString(1, reginfo.getLicKey()); ps.setString(2, reginfo.getEmailAddress().toString()); ps.setString(3, reginfo.getFirstName()); ps.setString(4, reginfo.getLastName()); int rtn = ps.executeUpdate(); } finally { if (c != null) { connector.closeConnection(c); } if (ps != null) { ps.close(); } // also closes the result set }