Given the records from the STUDENT table:
Given the code fragment:
Assume that the URL, username, and password are valid.
What is the result?
Given the records from the STUDENT table:
Given the code fragment:
Assume that the URL, username, and password are valid.
What is the result?
In the given code fragment, the method moveToInsertRow() is used to move the cursor to the insert row. According to JDBC specifications, calling updateRow() while the cursor is on the insert row can throw a SQLException. Proper use for inserting a new row involves moving to the insert row, updating the columns, then calling insertRow(), not updateRow(). As the program attempts to use updateRow() on the insert row, it will throw an SQLException at runtime.
D because called refresh() before calling rs.insertRow() so updates in insert row lost (can someone confirm this please???) Also, if moveToInsertRow() removed, and called rs.updateRow() at the end, then answer would be C???
Yes you are right.thats correct
D. SQL Exception due to rs.moveToInsertRow(); If we delete rs.moveToInsertRow(); the programm works fine
Answer is D, because the correct way to insert a row is rs.insertRow(). Calling updateRow() at the insertion row throws SQL exception
movetoInsertRow() moves position to "next row when record can be inserted". So it looks that content is inserted after row "114". refresh() is called after updateRow(). It is ok inserted content is not lost. C in my opinion.
This method cannot be called when the cursor is on the insert row. for rs.moveToInsertRow(); Ok