File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception calling Stored Procedure

 
gokul maha
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have the below code to execute a DB2 SP.

String spName = "ABC.PQR(?,?,?,?,?,?)";
String sql = "{Call " + spName+ "}";
CallableStatement cStmt = con.prepareCall(sql);

cStmt.setBinaryStream(1,inputStream, inputStreamAvailable);
cStmt.setBinaryStream(2,inputStream1, inputStreamAvailable1);
cStmt.setTimestamp(3,startDate);
cStmt.registerOutParameter(4,Types.VARCHAR);
cStmt.registerOutParameter(5,Types.INTEGER);
cStmt.registerOutParameter(6,Types.CHAR);
cStmt.execute();


When running the SP from applciation, it is giving below exception at execute.

Exception:com.ibm.db2.jcc.a.SqlException: DB2 SQL error: SQLCODE: -440, SQLSTATE: 42884, SQLERRMC: ABC.PQR;PROCEDURE

ABC - Schema name
PQR - SP name
Please help me regarding this.

Thanks in advance.
 
Matt Dudbridge
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The SQLState code (42884) would imply that the arguments you are passing are incompatible with your stored proc or DB2:

"No authorized routine named '<routineName>' of type '<type>' having compatible arguments was found."

A handy reference for SQLStates can be found at http://db.apache.org/derby/docs/10.1_old/ref/rrefexcept71493.html .

Cheers,
Matt
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic