Mysql-Eclipse cannot connect to MYSQL with JDBC

Source: Internet
Author: User
I cannot connect to MySQL using JDBC. my network is a campus network, and the IP address changes after I log on. I don't know if this will affect the connection, I used mysql5.6 to connect to MySQL using JDBC, but now I can't do it. I have found the cause on the internet but cannot find a solution, the connected JAR package is a mysql-connector-java-5.1.26-bin.jar with the error Communicationlinkfailure, messagefromserver: & quot; Can & #39; tgethostnameforyouradd mysqljdbc

I cannot connect to MySQL using JDBC. my network is a campus network, and the IP address changes after I log on. I don't know if this will affect the connection, I used mysql 5.6 to connect to mysql using JDBC, but now it cannot be used. I am not clear about the reason and have found it online, but I cannot find a solution, the connected JAR package is a mysql-connector-java-5.1.26-bin.jar with the error Communication link failure, message from server: "Can't get hostname for your address"
At sun. reflect. NativeConstructorAccessorImpl. newInstance0 (Native Method)
At sun. reflect. NativeConstructorAccessorImpl. newInstance (Unknown Source)
At sun. reflect. DelegatingConstructorAccessorImpl. newInstance (Unknown Source)
At java. lang. reflect. Constructor. newInstance (Unknown Source)
At com. mysql. jdbc. Util. handleNewInstance (Util. java: 408)
At com. mysql. jdbc. Util. getInstance (Util. java: 383)
At com. mysql. jdbc. SQLError. createSQLException (SQLError. java: 1023)
At com. mysql. jdbc. SQLError. createSQLException (SQLError. java: 997)
At com. mysql. jdbc. SQLError. createSQLException (SQLError. java: 983)
At com. mysql. jdbc. MysqlIO. doHandshake (MysqlIO. java: 1111)
At com. mysql. jdbc. ConnectionImpl. coreConnect (ConnectionImpl. java: 2494)
At com. mysql. jdbc. ConnectionImpl. connectOneTryOnly (ConnectionImpl. java: 2527)
At com. mysql. jdbc. ConnectionImpl. createNewIO (ConnectionImpl. java: 2309)
At com. mysql. jdbc. ConnectionImpl. (ConnectionImpl. java: 834)
At com. mysql. jdbc. JDBC4Connection. (JDBC4Connection. java: 46)
At sun. reflect. NativeConstructorAccessorImpl. newInstance0 (Native Method)
At sun. reflect. NativeConstructorAccessorImpl. newInstance (Unknown Source)
At sun. reflect. DelegatingConstructorAccessorImpl. newInstance (Unknown Source)
At java. lang. reflect. Constructor. newInstance (Unknown Source)
At com. mysql. jdbc. Util. handleNewInstance (Util. java: 408)
At com. mysql. jdbc. ConnectionImpl. getInstance (ConnectionImpl. java: 419)
At com. mysql. jdbc. NonRegisteringDriver. connect (NonRegisteringDriver. java: 344)
At java. SQL. DriverManager. getConnection (Unknown Source)
At java. SQL. DriverManager. getConnection (Unknown Source ).

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.