|
If your transactions aren't working with your new MySQL database you may have the same problem I just had. I created my database tables with the default database engine (MyISAM), and guess what? The default engine doesn't support transactions. The cool thing about MySQL is that it does support multiple database engines, so what you need to do to fix the transactions-not-working problem is specify an MySQL database engine that does support transactions.
To specify a different engine that does support transactions -- like InnoDB -- use the following syntax, taking care to note the engine specification at the end of the CREATE TABLE command:
create table users (
id int auto_increment not null unique,
username varchar(32) not null unique,
password varchar(16) not null,
primary key (id)
) ENGINE = InnoDB;
In my case that's all I had to do to get my transactions working. FWIW, I'm using Java and Spring JSBC on my current project, and the transaction support in that framework works as advertised.
For more information on MySQL transactions and database storage engines I'll refer you to this MySQL page on storage engines.
|