Database Link report Exception communications link failure. Last packet sent to the server was 0 Ms Ago.__ database

Source: Internet
Author: User
Java program porting to Linux system, there is no connection error MySQL. Tip Communications Link FAILURE20 program is running under Windows, but under Linux, there are error prompts communications link failure. Last packet sent to the server was 0 ms ago. In which, the MySQL driver can load normally,
Connection connect = drivermanager.getconnection ("Jdbc:mysql://localhost:3306/iems", "root", "123.com"); There was an exception to this sentence.
Looked at a number of solutions, not threading issues, nor connection time issues. The firewall is also closed. Ask the expert to help answer, thank you



Last packet sent to the server is 2 ms ago solution attempted reconnect 3 times. Giving up. Solution

must first determine whether the URL and username password is configured correctly, look at the connection string, the port is configured correctly
 
and then use the URL on the Internet to prefix the autoreconnect=true
 
jdbc:mysql:/ /localhost:3306/oa?autoreconnect=true
 
or
 
edit the MySQL directory: my.cnf (My.ini under Windows), plus
 
wait_timeout= 31536000

interactive_timeout=31536000

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.