I open a new thread because I want you to read the solution directly instead of digging for it in another thread which has lots of "noise" in it.
My problem was that although I rolled back a transaction in code (tx.rollback), the data has not been rolled back in my MySQL DB.
Then I figured out that MySQL 4.0 uses MyISAM tables by default. Don't ask me what MyISAM means. To me it means that these tables are not capable of rolling back a transaction. They seem to be doing autocommit.
A MySQL table has to be of table type InnoDB in order to be rollback capable. You can convert any MySQL table to InnoDB. But I was looking for a more general solution. I wanted to set the default table type to InnoDB. So I would never have to worry again.
It seems that the only way to do this is to use a start the database with a special start parameter: C:/mysql/bin/mysqld-max-nt.exe --default-table-type=InnoDB
If you start the MySQL DB server like this, every normally created table will be of type InnoDB and thus rollback capable. I think thats what most of the serious database people want.
First I wanted to use a Windows service. But for that purpose I needed to start the service with that parameter (--default-table-type=InnoDB). I can enter a parameter in Windows XP Professional, but when the service starts automatically (when the PC is rebooted), the service is started WITHOUT that parameter. That meant MyISAM default table type!
Then I tried to modify the registry: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MySql\ImagePath
But I could not set the parameter successfully in the registry. When I did, the service did not start properly.
So my solution now is to use a .bat file which I named startMySQL.bat. It contains a single line: C:/mysql/bin/mysqld-max-nt.exe --default-table-type=InnoDB
To start the MySQL DB server, I just double click on that .bat file. The server starts after a few seconds. Then you can kill the DOS box. Nevertheless the server remains up and running in the background.
This solution is not so nice like a Windows service. So if anyone knows how to achieve the same with a Windows service (startind the MySQL DB with default table type InnoDB), please tell me.
I hope I have contributed to solve this problem.
|