您的位置:首页 > 大数据 > 人工智能

CommunicationsException: Communications link failu

2015-12-18 10:34 441 查看
So, you have a

CommunicationsException: Communications link failure


I'm quoting from this answer which also contains a step-by-step MySQL+JDBC tutorial:

If you get a SQLException: Connection refused or Connection timed out or a MySQL specific CommunicationsException: Communications link failure, then it means that the DB isn't reachable at all. This can have one or more of the following causes:

IP address or hostname in JDBC URL is wrong.

Hostname in JDBC URL is not recognized by local DNS server.

Port number is missing or wrong in JDBC URL.

DB server is down.

DB server doesn't accept TCP/IP connections.

DB server has run out of connections.

Something in between Java and DB is blocking connections, e.g. a firewall or proxy.

To solve the one or the other, follow the following advices:

Verify and test them with ping.

Refresh DNS or use IP address in JDBC URL instead.

Verify it based on my.cnf of MySQL DB.

Start the DB.

Verify if mysqld is started without the --skip-networking option.

Restart the DB and fix your code accordingly that it closes connections in finally.

Disable firewall and/or configure firewall/proxy to allow/forward the port.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: