posted 16 years ago
Hi,
I am getting "java.sql.SQLException: No data read" when I run the following code.
but when I used ResultSet rs = stmt.executeQuery(); (the commented line in the code)
I do n't get any error. Can any one please explain the reason for this?
(The query is not returning any rows from DB,
rs is not null in both the cases.
ResultSet rs = stmt.getResultSet();
or
ResultSet rs = stmt.executeQuery();
)
<CODE --- STARTS >
con = ConnectionMain.getDbConnection();
CallableStatement cstmt = con.prepareCall("{ call XXXX(?, ?, ?) }");
cstmt.setString(1, set1);
cstmt.setString(2, set2);
cstmt.registerOutParameter(3, Types.VARCHAR);
cstmt.execute();
app = cstmt.getString(3);
if (app == null || app.length()==0) {
PreparedStatement stmt = con.prepareStatement(query);
stmt.setString(1, app_num);
ResultSet rs = stmt.getResultSet();
//ResultSet rs = stmt.executeQuery();
if (rs.next()) {
app = rs.getString(1);
}
stmt.close();
rs.close();
}
<CODE --- ENDS>
thanks