与JDBC的Java JDBC连接使用localhost和127.0.0.1,但不适用于Windows 10上的公共IP

时间:2017-03-02 18:40:10

标签: java mysql jdbc

我设置了一个简单的JDBC连接来连接我本地运行的MySQL实例。当我将IP设置为" localhost"时,连接正常。或" 127.0.0.1",但在使用我的公共IP地址时失败。我不确定它是否是Windows 10,MySQL或其他完全配置问题。

我的代码:

Error with JDBC Connection: 

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

我收到的错误是:

void swap(HasPtr &lhs, HasPtr &rhs)
{...}

void swap(int &lhs, int &rhs) { std::swap(lhs, rhs); }
void swap(char &lhs, char &rhs) { std::swap(lhs, rhs); }
// etc. for other std::swap overloads of common types

void swap(Foo &lhs, Foo &rhs)
{
    swap(lhs.h, rhs.h);
    // the other overloads of swap go out of scope here.
}

0 个答案:

没有答案