Mysql异常:Communication link failure, message from server: "Can't get hostname for your address"的解决方法及验证
)
1.异常发现
在JDBC中用Eclipse与MySql通过DriverManager建立连接时,出现这样的错误(已导包):
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communication link failure, message from server: "Can't get hostname for your address"
其中建立连接代码如下(仅个人)
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class JdbcText {
public