About Question enthuware.ocpjp.v8.2.1911 :
Moderator: admin
-
- Posts: 29
- Joined: Sun Feb 07, 2021 6:30 pm
- Contact:
About Question enthuware.ocpjp.v8.2.1911 :
Just wanted to confirm, if we wanted to see the updates, then we could make 1 of the following modifications:
1. rs1.refreshRow() before printing
OR
2. change mode to TYPE_SCROLL_SENSITIVE (for stmt1)
OR
3.
declare
ResultSet rs1 = stmt1.executeQuery(query);
AFTER
rs2.updateRow();
(don't need stmt1 after rs2.updateRow() as the static view of the database is at the time of query)
Can someone confirm if my understanding is correct please?
1. rs1.refreshRow() before printing
OR
2. change mode to TYPE_SCROLL_SENSITIVE (for stmt1)
OR
3.
declare
ResultSet rs1 = stmt1.executeQuery(query);
AFTER
rs2.updateRow();
(don't need stmt1 after rs2.updateRow() as the static view of the database is at the time of query)
Can someone confirm if my understanding is correct please?
-
- Site Admin
- Posts: 10065
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1911 :
That is correct.
If you like our products and services, please help us by posting your review here.
-
- Posts: 29
- Joined: Sun Feb 07, 2021 6:30 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1911 :
if //2
was using rs2.getString("zip"), then would answer have been B?
or would you need to call rs2.refreshRow() after //1 for it to be visible?
was using rs2.getString("zip"), then would answer have been B?
or would you need to call rs2.refreshRow() after //1 for it to be visible?
-
- Site Admin
- Posts: 10065
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1911 :
Yes, in that case answer would be B.
If you like our products and services, please help us by posting your review here.
-
- Posts: 29
- Joined: Sun Feb 07, 2021 6:30 pm
- Contact:
-
- Site Admin
- Posts: 10065
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1911 :
No, insensitive is about the changes made to the db by other means. If you change the same resultset then you will see new values.
You may run a simple test program to check it out and/or go through the API JavaDoc: https://docs.oracle.com/en/java/javase/ ... ction.html
You may run a simple test program to check it out and/or go through the API JavaDoc: https://docs.oracle.com/en/java/javase/ ... ction.html
If you like our products and services, please help us by posting your review here.
-
- Posts: 29
- Joined: Sun Feb 07, 2021 6:30 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1911 :
Ah that would makes sense, thank you!!!admin wrote: ↑Wed Apr 14, 2021 4:12 amNo, insensitive is about the changes made to the db by other means. If you change the same resultset then you will see new values.
You may run a simple test program to check it out and/or go through the API JavaDoc: https://docs.oracle.com/en/java/javase/ ... ction.html
-
- Posts: 29
- Joined: Sun Feb 07, 2021 6:30 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1911 :
Just looking at Q71 here: https://www.examtopics.com/exams/oracle ... 9/view/15/admin wrote: ↑Wed Apr 14, 2021 4:12 amNo, insensitive is about the changes made to the db by other means. If you change the same resultset then you will see new values.
You may run a simple test program to check it out and/or go through the API JavaDoc: https://docs.oracle.com/en/java/javase/ ... ction.html
Answer is C but that would then go against what you have just said...
When I looked at this Q71 and read your explanation I thought the answer would therefore be:
The Employee table is not updated and the program prints: 112 Jack
because updateString(2) updates the same ResultSet, but updateRow() has not been called, so the database is not updated.
But this is not an option at all.
have I misunderstood something? D:
-
- Site Admin
- Posts: 10065
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1911 :
Unless updateRow is called the database will not be updated. That's pretty clear from the documentation: https://docs.oracle.com/en/java/javase/ ... ltSet.html
To see the changes made to the database by other processes/other resultsets in your ResultSet, you need to invoke refreshRow, that is also clear.
So, I am not sure what is the confusion?
To see the changes made to the database by other processes/other resultsets in your ResultSet, you need to invoke refreshRow, that is also clear.
So, I am not sure what is the confusion?
If you like our products and services, please help us by posting your review here.
-
- Posts: 29
- Joined: Sun Feb 07, 2021 6:30 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1911 :
My understanding was thatadmin wrote: ↑Wed Apr 21, 2021 10:52 pmUnless updateRow is called the database will not be updated. That's pretty clear from the documentation: https://docs.oracle.com/en/java/javase/ ... ltSet.html
To see the changes made to the database by other processes/other resultsets in your ResultSet, you need to invoke refreshRow, that is also clear.
So, I am not sure what is the confusion?
-rs.updateXXX(colName, newValue) //update columns IN ResultSet
-Call rs.updateRow(); //to update IN db with (ResultSet updates commited to db…)
But I'm guessing it should be:
-rs.updateXXX(colName, newValue) //update columns but not commit changes to either ResultSet or db
-Call rs.updateRow(); //to update IN ResultSet AND db
can you confirm this is now 100% correct? (because I keep doubting myself D:)
-
- Site Admin
- Posts: 10065
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1911 :
NO!!!
This is correct and that is what I wrote before as well (twice). Please see my responses above. Specifically:My understanding was that
-rs.updateXXX(colName, newValue) //update columns IN ResultSet
-Call rs.updateRow(); //to update IN db with (ResultSet updates commited to db…)
I am not sure what the other question provider says or means. You need to ask them about it.If you change the same resultset then you will see new values.
You may run a simple test program to check it out and/or go through the API JavaDoc: https://docs.oracle.com/en/java/javase/ ... ction.html
If you like our products and services, please help us by posting your review here.
-
- Site Admin
- Posts: 10065
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1911 :
As I mentioned earlier, you need to go through the documentation at: https://docs.oracle.com/en/java/javase/ ... ltSet.html
The example given there clearly says:
The example given there clearly says:
The following code fragment updates the NAME column in the fifth row of the ResultSet object rs and then uses the method updateRow to update the data source table from which rs was derived.
rs.absolute(5); // moves the cursor to the fifth row of rs
rs.updateString("NAME", "AINSWORTH"); // updates the
// NAME column of row 5 to be AINSWORTH
rs.updateRow(); // updates the row in the data source
If you like our products and services, please help us by posting your review here.
-
- Site Admin
- Posts: 10065
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1911 :
Or just write a test program and check it out!
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 98 guests