Win a copy of liveProject: Protecting User Data with Spring Security and OAuth2 this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

ResultSet and Underlying Database Question

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Q71 From https://www.examtopics.com/exams/oracle/1z0-809/view/15/ :

Q71
Given the records from the Employee table:
eid ename
111 Tom
112 Jerry
113 Donald
and given the code fragment:

Assume that:
The required database driver is configured in the classpath.
The appropriate database accessible with the URL, userName, and passWord exists.
What is the result?

A. The Employee table is updated with the row: 112 Jack and the program prints: 112 Jerry
B. The Employee table is updated with the row: 112 Jack and the program prints: 112 Jack
C. The Employee table is not updated and the program prints: 112 Jerry
D. The program prints Exception is raised.

My understanding is that:
1. rs.updateXXX(colName, newValue) //update columns IN ResultSet
2. Call rs.updateRow(); //to update IN db with (ResultSet updates commited to db…)

and here, although we are in TYPE_SCROLL_INSENSITIVE mode - that is to do with the db being changed by other means e.g. through different ResultSets,
here, we are updating the same ResultSet, so any updates to rows should be visible.

From this, the answer should therefore be:
The Employee table is not updated and the program prints: 112 Jack
(table not updated because rs.updateRow() was never called, but "Jack" because of 1.^)
which is not an option...

Can someone confirm if my understanding is correct and that the answers A/B/C/D are wrong?

 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic