About Question enthuware.ocpjp.v7.2.1196 :
Moderator: admin
-
- Posts: 78
- Joined: Sun Jun 30, 2013 10:04 pm
- Contact:
About Question enthuware.ocpjp.v7.2.1196 :
For this question,
"Assuming that the table student2 does not have any row, how many rows will be present in this table after the following code is executed? "
"Assuming that the table student2 does not have any row"
does this statement have any relevance on the choice to select?
"Assuming that the table student2 does not have any row, how many rows will be present in this table after the following code is executed? "
"Assuming that the table student2 does not have any row"
does this statement have any relevance on the choice to select?
-
- Site Admin
- Posts: 10062
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1196 :
Well, if the table already has rows, then none of the options can be valid.
If you like our products and services, please help us by posting your review here.
-
- Posts: 17
- Joined: Wed Nov 26, 2014 1:59 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1196 :
So, 'setAutoCommit(true)' saves all previously pending 'inserts'? (this sounds strange...)
-
- Site Admin
- Posts: 10062
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1196 :
Yes, but only if the auto commit mode was false before. You should go through this JavaDoc description: http://docs.oracle.com/javase/7/docs/ap ... t(boolean)leorbarbosa wrote:So, 'setAutoCommit(true)' saves all previously pending 'inserts'? (this sounds strange...)
If you like our products and services, please help us by posting your review here.
-
- Posts: 31
- Joined: Tue Oct 06, 2015 1:57 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1196 :
I am having some issues with MySQL otherwise I would try this myself but here is my question....
Does calling conn.rollback() (w/o a savepoint passed in) roll all statements in the transaction back or does it rollback statements up until it encounters and unnamed savepoint?
pseudocode:
autocommit(off)
stmt.executeupdate(1)
savepoint unnamed
stmt.executeupdate(2)
savepoint named
rollback - no savepoint given
commit
Does this sequence rollback back to the unnamed savepoint and then commit update1 or does it rollback everything and commit nothing?
Does calling conn.rollback() (w/o a savepoint passed in) roll all statements in the transaction back or does it rollback statements up until it encounters and unnamed savepoint?
pseudocode:
autocommit(off)
stmt.executeupdate(1)
savepoint unnamed
stmt.executeupdate(2)
savepoint named
rollback - no savepoint given
commit
Does this sequence rollback back to the unnamed savepoint and then commit update1 or does it rollback everything and commit nothing?
-
- Site Admin
- Posts: 10062
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1196 :
A call to rollback() will roll back all the changes done in this transaction (irrespective of any save points).
A call to rollback(SavePoint) will roll back only those changes made after the given save point.
So in your example everything (after setting autocommit(off) ) will be rolled back.
HTH,
Paul.
A call to rollback(SavePoint) will roll back only those changes made after the given save point.
So in your example everything (after setting autocommit(off) ) will be rolled back.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 1
- Joined: Mon Jul 25, 2016 12:58 am
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1196 :
I agree with rollback and savepoint logic for 2 rows.
But database will not be updated unless:
Statement stmt = c.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
NOT Statement stmt = c.createStatement();
But database will not be updated unless:
Statement stmt = c.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
NOT Statement stmt = c.createStatement();
Who is online
Users browsing this forum: No registered users and 104 guests