*
The moose likes JDBC and the fly likes Exception calling Stored Procedure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Exception calling Stored Procedure" Watch "Exception calling Stored Procedure" New topic
Author

Exception calling Stored Procedure

gokul maha
Greenhorn

Joined: Jun 27, 2006
Posts: 25
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

Joined: Nov 22, 2006
Posts: 2
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


Matt Dudbridge<br /><a href="http://mattdud.com" target="_blank" rel="nofollow">http://mattdud.com</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception calling Stored Procedure
 
Similar Threads
Calling Stored Procedure from Spring StoredProcedure throws Exception
stored procedure giving me sql error
Confused by stored procedure sql error
Confused by Stored Procedure Error
Problem: Spring - Stored Procedure call