Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

transaction .... shmansaction

 
Dave Wingate
Ranch Hand
Posts: 262
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy all,

I'm taking my first stab at using transactions with JDBC code. I found this article from sun, but the code's not working for me:




I used a debugger to confirm that the rollback() method is getting executed, but I still end up with new DB rows.

I'm using MySQL for my DB. Could that be the problem? I'd appreciate any advice that the ranchers may have.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm using MySQL for my DB. Could that be the problem?

Probably. If you want to use transactional stuff you need to make sure you are using a database which supports them. Some of the MySQL database engines (including the default ISAM) amazingly don't. Create your table using one of the db engines that supports transactions and you should be OK.
 
Bryan Scarbrough
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably. If you want to use transactional stuff you need to make sure you are using a database which supports them.


MySQL 4.0.x.x does support transactions, BUT, you must use the InnoDB table type.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic