Hi all, I trying to call a stored procdure and i am getting the above mentioned error. I am enclosing both code and the error, pls let me know what could have been the problem. I am really going crazy with this. public MessageList retrieveMessageList(PortalID portalID) throws PortalIDNotFoundException {
CallableStatement callableStmt = getConnection().prepareCall(sql); // set the input parameters callableStmt.setString(1, portalUserID); callableStmt.setString(2, groupList); // register the output parameters callableStmt.registerOutParameter(3, Types.CHAR); // exception type callableStmt.registerOutParameter(4, Types.CHAR); // exception text System.out.println("Calling stored procedure..."); callableStmt.execute(); System.out.println("done with execute()"); // retrieve the output parameters String exceptionType = callableStmt.getString(3).trim(); String exceptionText = callableStmt.getString(4).trim(); System.out.println("exceptionType = " + exceptionType); System.out.println("exceptionText = " + exceptionText); } catch (SQLException sqle) { sqle.printStackTrace(); }
ERROR COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver] CLI0112E Error in assignment. SQLSTATE=22005 at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java:260) at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java:197) at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(SQLExceptionGenerator.java:448) at COM.ibm.db2.jdbc.app.DB2PreparedStatement.execute2(DB2PreparedStatement.java:1247) at COM.ibm.db2.jdbc.app.DB2PreparedStatement.execute(DB2PreparedStatement.java:2389) at com.ghp.ids.impl.IDSFacadeImpl.retrieveMessageList(IDSFacadeImpl.java:252) at com.ghp.ids.impl.IDSFacadeTester.testRetrieveMessageList(IDSFacadeTester.java:25) at com.ghp.ids.impl.IDSFacadeTester.main(IDSFacadeTester.java:18)
Piyush Daiya
Ranch Hand
Joined: Jun 13, 2002
Posts: 67
posted
0
Hi,
Try changing the lines // register the output parameters callableStmt.registerOutParameter(3, Types.CHAR); // exception type callableStmt.registerOutParameter(4, Types.CHAR); // exception text
to // register the output parameters callableStmt.registerOutParameter(3, Types.VARCHAR); // exception type callableStmt.registerOutParameter(4, Types.VARCHAR); // exception text
HTH, Piyush
"A scientist is not person who gives right answers but a person who asks right questions"