I try to execute this procedure through CallableStatement, then I execute by calling the execute() method. When I process this using getMoreResults() & I am getting only update count, not my output parameter.

Joe Sam Shirah

Although you are always dependent on your driver capabilities, JDBC does provide a means of handling this sort of situation. execute() returns a boolean - true if the rusult is a ResultSet, false if an int is returned ( for update count or DDL ). From the API documentation: "The methods execute, getMoreResults, getResultSet, and getUpdateCount let you navigate through multiple results. The execute method executes an SQL statement and indicates the form of the first result. You can then use the methods getResultSet or getUpdateCount to retrieve the result, and getMoreResults to move to any subsequent result(s)."

A more complete explanation and example code is provided in JDBC API Tutorial and Reference, 2nd Ed: Java 2 in "Statements - 40.1.8 Executing Special Kinds of Statements". Unfortunately, this particular section does not appear to be available online.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact