I am trying to access cetain data from the database.
once I retrieve the data I have to process dat data and then update a particular column using the modified data.
I used the following code.
rs = stmt.executeQuery("select data from table where id = 2");
String description= rs.getString("data");
Executing SQL Statements with same Statemenet object without closing the resultSet opened will yeild uncharacteristic results. The solution should be to store the resultset values to a local objects (variables) , open a new resultset and use it execute the second Statement ( statement object can be same).
posted 10 years ago
Thank you for the previous reply!!!11
Could you please include the statements that are mssing in the code.
I am nt able to understand what am I supposed to da
Your example:would throw an exception, because stmt is null when you call it's executeQuery() method.
In your initial example, you change the original stmt inside of your loop.
Maybe this corrupts your loop, because the ResultSet you associated with the Statement is closed when you call a new operation (executeOpdate()) on that same statement?