• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Exception calling Stored Procedure

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic