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 ).