This week's book giveaways are in the Cloud and AI/ML forums.
We're giving away four copies each of Cloud Native Patterns and Natural Language Processing and have the authors on-line!
See this thread and this one for details.
Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Difference between JDBC based transaction and the Java Transaction API

 
Greenhorn
Posts: 9
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am just beginning to work on a  JAVA based project under which I have an option to use either a JDBC based transaction or the Java Transaction API? Now, I am not much aware of both of them, but I went through few posts online. However, I couldn't really understand when to use which one? How do we differentiate what would suit our need under which scenario?
 
Marshal
Posts: 65025
247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's move you to our databases forum.

Don't know about the transaction API, but I know that transactions aren't part of JDBC; they are part of the database program. The database can run a transaction for you and you use JDBC to request a transaction. A transaction in a database runs to completion before anything else is committed to memory. During a transaction no other code may access the information used in that transaction. I would think you are better off looking for an SQL/databases tutorial and looking for its section about transactions (or you may have a book about databases, or lecture notes about databases). I would take it for granted that the tutorial/lecture/book would explain what ACID means. I think a tutorial/book/lecture would be better than finding a post.
 
Saloon Keeper
Posts: 5703
144
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The main difference between JDBC transactions and the JTA is that JTA supports transactions across DBs, something that is beyond JDBC. So unless you need to synchronize two or more DBs, I suggest to stick to JDBC transactions.

Campbell Ritchie wrote:A transaction in a database runs to completion before anything else is committed to memory. During a transaction no other code may access the information used in that transaction.


That depends on the transaction isolation level used by the DB, a concept that is supported by the JDBC (although not all DBs supports all the levels than JDBC does).
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!