• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Commit & Rollback in Java?

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm learning Java, and am an absolute beginner (page 243 Head First Java), but was wondering about the following:

1) How does Java deal with Commit and Rollback situations during transaction processing?

2) Are there any reserved words to that effect?

Thank you for your time
 
Marshal
Posts: 64642
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java doesn't deal with commit, nor with rollback. That is done by the database program. The keywords are "commit" and "rollback" but they are both SQL keywords, not Java keywords.

This thread would sit better on the JDBC forum, so I shall move it.
 
Fantine Ponter
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you. I apologize for entering my question in the wrong spot.
 
Campbell Ritchie
Marshal
Posts: 64642
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome There is no need to feel bad about where you posted.
[ November 26, 2008: Message edited by: Campbell Ritchie ]
 
author & internet detective
Posts: 39341
755
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fantine,
There are methods with those names in Java. If you decide to handle transactions explicitly, you can choose to commit or rollback.
 
Fantine Ponter
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Jeanne.

As a matter of interest, which class(es) do those methods belong to? Are they in the Java API?

I would try to test it now if I were further advanced in my Java studies, but will have to wait until i know a few more things. I have not learnt how to call SQL in Java yet, nor do I know how to read a file or write to a file yet.

It actually isn't important for me to know the answers, as I said before, I was just curious to see how Java programming handles commit and rollback.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


As a matter of interest, which class(es) do those methods belong to? Are they in the Java API?


In the context of JDBC thay are methods on the Connection class.

I'm not sure you have seen this yet, but if you have a method name and you want to find out what class it belongs to, have a look at the index that JavaDoc tool produces.
 
Fantine Ponter
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow! So much to learn, so little time... Thanks Paul. I've saved the site as a favourite.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!