eldoz12
asked on
how to handle return values for update sql
Hello experts ,
I call sp which updates a some tables , they return a single row with value 0 if the update is successful ,
The problem is that my program crashes whenever it receives the row back on the update statement ,
Plz advice on how to handel return values on update statments
error log
java.sql.SQLException: JZ0P1: Unexpected result type. Query:
I call sp which updates a some tables , they return a single row with value 0 if the update is successful ,
The problem is that my program crashes whenever it receives the row back on the update statement ,
Plz advice on how to handel return values on update statments
error log
java.sql.SQLException: JZ0P1: Unexpected result type. Query:
ASKER
Below is the code i use for update
public void approveFiling(Integer recordId) throws DAOException, ResourceException {
this.setIgnoreWarnings(tru e);
String sql="exec spApprove " + recordId;
Object[] args = null;
this.updateThrowsDAOExcept ion(conn,s ql,args);
}
public int updateThrowsDAOException(C onnection conn, String sql, Object[] params)
throws DAOException, ResourceException {
PreparedStatement stmt = null;
int rows = 0;
try {
stmt = this.prepareStatement(conn , sql);
this.fillStatement(stmt, params);
if(timeoutInSec < Integer.MAX_VALUE )
stmt.setQueryTimeout(timeo utInSec);
if(maxRows < Integer.MAX_VALUE)
stmt.setFetchSize(maxRows) ;
rows = stmt.executeUpdate();
SQLWarning warn = stmt.getWarnings();
throwExceptionOnWarningIfN otIgnoring Warnings(w arn);
} catch (SQLException e) {
this.createDAOException(e, sql, params);
} finally {
close(stmt);
}
return rows;
}
public void approveFiling(Integer recordId) throws DAOException, ResourceException {
this.setIgnoreWarnings(tru
String sql="exec spApprove " + recordId;
Object[] args = null;
this.updateThrowsDAOExcept
}
public int updateThrowsDAOException(C
throws DAOException, ResourceException {
PreparedStatement stmt = null;
int rows = 0;
try {
stmt = this.prepareStatement(conn
this.fillStatement(stmt, params);
if(timeoutInSec < Integer.MAX_VALUE )
stmt.setQueryTimeout(timeo
if(maxRows < Integer.MAX_VALUE)
stmt.setFetchSize(maxRows)
rows = stmt.executeUpdate();
SQLWarning warn = stmt.getWarnings();
throwExceptionOnWarningIfN
} catch (SQLException e) {
this.createDAOException(e,
} finally {
close(stmt);
}
return rows;
}
You didn't post the full stack trace
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Please post full exception stack trace + code