Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can get the return code of a StoreProcedure?

 
Li Shangqiang
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in my store procedures, sometime i return some numbers; but how can i get it? In this case getResultSet() generate a error, getUpdateCount() return -1. My database is SQL Server, and dirver is JDBC-ODBC Bridge
 
SimplyEd Me
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
E.g.
final String sqlCallDEPRejects = "{? = call dep_rejects (?)}";
CallableStatement cstmt = con.prepareCall(sqlCallDEPRejects);
cstmt.registerOutParameter(1,java.sql.Types.INTEGER);
cstmt.setString(2, "2" + " ");
cstmt.execute();
int totalMoved = cstmt.getInt(1);
cstmt.close();
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic