[转帖]连不上mysql _MySQL, Oracle及数据库讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  MySQL, Oracle及数据库讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 1752 | 回复: 0   主题: [转帖]连不上mysql         下一篇 
wzj
注册用户
等级:新兵
经验:67
发帖:64
精华:0
注册:2011-11-15
状态:离线
发送短消息息给wzj 加好友    发送短消息息给wzj 发消息
发表于: IP:您无权察看 2014-12-17 16:15:10 | [全部帖] [楼主帖] 楼主

报错如下:

com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.net.SocketException
MESSAGE: java.net.ConnectException: Connection refused: connect
STACKTRACE:
java.net.SocketException: java.net.ConnectException: Connection refused: connect
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:284)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2555)
at com.mysql.jdbc.Connection.<init>(Connection.java:1485)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at test.mysqlTest.getConnection(mysqlTest.java:24)
at test.mysqlTest.main(mysqlTest.java:43)
** END NESTED EXCEPTION **
and more


myeclipse连部上mysql,报错如上:

应该是没啥大问题的,但就是在我机器上连不上mysql.

困扰了几天,最后在mysql网站上看到这段:

"Connection reset by peer" means that a connection was made or partly made (somewhere) and then terminated on the remote end. Unfortunately, it doesn't tell you what was on the other end, or why it terminated the connection.
If the connection is being made through a proxying firewall (such as one that is doing NAT (network address translation)), what may be happening is that the firewall is receiving the connection request and accepting it on the extrnal side, while at the same time trying to open a connection on the internal side to the database. That's getting refused and then the firewall is tearing down the external connection. That's a long-winded way of saying that "Connection reset by peer" can be the same as "Connection refused" when there are connection-proxying network components in the transmission path.
You could be getting this because (1) the URL of the DB is wrong, because (2) the DB isn't set up to accept connections from the web host, or because (3) some intermediate networking component is misconfigured. (1) is your problem; (2) and (3) might be your problem or the web hosting's problem, depending on where the DB is located, what administrative privileges on the DB that you have, and how the networking is set up.


--转自 北京联动北方科技有限公司




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论