Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION **
2016-07-29 11:02
477 查看
public static void main(String[] args) { String URL = "jdbc:mysql://localhost:3306/flexigrid"; String USERNAME = "root"; String PASSWORD = "xinxin"; try { // 初始化驱动包 Class.forName("com.mysql.jdbc.Driver"); // 根据数据库连接字符,名称,密码给conn赋值 Connection connection = DriverManager.getConnection(URL, USERNAME,PASSWORD); System.out.println("数据库连接成功" + connection); } catch (Exception e) { e.printStackTrace(); } }
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.net.ConnectException
MESSAGE: Connection refused: connect
STACKTRACE:
java.net.ConnectException: Connection refused: connect
先查看mysql是否开启服务:输入net start mysql 回车即可启动;关闭输入net stop mysql 回车即可。
这个错是链接数据库的参数有错误,我的是端口号错了,默认端口号3306,但是被人修改为3337。
1.我们一般最常见的工具是telnet,但是telnet使用的是tcp协议,换句话说telnet只能检测tcp的这个端口打开了没,
运行telnet 192.192.193.211 22 来查看。
2.还有netstat命令查看端口号,netstat help 查看可选参数。netstat -a就可以查看所有端口。
相关文章推荐
- Communications link failure due to underlying exception
- com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
- com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
- 解决mysql连接异常—-com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception
- 在使用mysql时出现Communications link failure due to underlying exception
- com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
- Error: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying except
- 解决MySQL连接超时Communications link failure due to underlying exception
- 解决MySQL连接超时Communications link failure due to underlying exception
- com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception
- com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
- Mysql报错!Communications link failure due to underlying exception
- java工程连接远程MySQL数据库报错:Communications link failure due to underlying exception
- 驱动注册成功 com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.net.Conn
- 解决mysql连接异常—-com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception
- com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:的解决
- JDBC学习之道:JDBC中的Communications link failure due to underlying exception错误的解决办法
- com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
- Communications link failure due to underlying exception: Connection timed out: connect
- Cause: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying...的解决