Invalid automatic submission of mysql settings

Source: Internet
Author: User


I have never used mysql for several years... Mysql is used for a small task today. A very simple problem. After several hours, it seems that ignorance is terrible .. Go to the topic. The problem is simple. JDBC connects to mysl to get connnection and then conn. setAutoCommit (false); the point is to insert a record, inset1 ...... then perform some logic processing to update another data update2... Finally, conn. commit (); of course, there is conn. rollback () in catche (). DEBUG finds that the database has a value after insert1 is executed .. I thought it was an isolation-level problem and did not care about it. Then proceed to the logic processing. The conn. reollback () exception occurs .. The inserted data is not rolled back. The code is checked N times without any problems. I have no choice but to ask du Niang, Gu Ye... This period of time is suffering ~~~~ Www.2cto.com is still fruitful. I found an article about the mysql table storage engine. Show create table name;

We can see that ENGINE = MyISAMMyISAM refers to the default storage ENGINE of Mysql. When creating a new table without specifying the storage ENGINE for the new table, Myisam is used by default. MyISAM manages non-transaction tables. It provides high-speed storage and retrieval, and full-text search capabilities. Since there are non-transaction tables, there should be tables that support transactions. Indeed, du Niang told me that the InnoDBInnoDB storage engine provides transaction security with the ability to commit, roll back, and crash recovery. However, compared with the storage engine of Myisam, InnoDB writes less efficiently and occupies more disk space to retain data and indexes. Let's change it .. Alter table name engine = InnoDB; then let's take a look.

Changed to InnoDB .. Run the program again .. That's right. Roll back... Very small problem .... However, if you do not know about Mysql, it is also a headache .. After several hours... Ignorance is a sad reminder ....
Author: Beijing-Wang Zhiwei

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.