MySQL Communications link failure (with HTTP request)

Source: Internet
Author: User
Com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:Communications link failure during rollback () .
See this error first look at the code, first think, I first opened the database connection, and executed the query and insert operation is no problem ah, but the final rollback on the issue, the following according to the log analysis:


Solution:
1. Modify HTTP request time, connection request Timeout + read Timeout <60ms
2. Do not place the HTTP request in the transaction operation of the database:
1) Perform the database operation before the HTTP request, then execute the HTTP request, the state of the operation before the update (success, failure, unknown)
2) database records allow certain data loss, execute HTTP requests first, and then write execution results to the database

MySQL Communications link failure (with HTTP request)

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.