无法创建PoolableConnectionFactory

uja*_*ava 21 java mysql hibernate

问题是什么?无法连接数据库?

   org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (
            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.)
Run Code Online (Sandbox Code Playgroud)

Buh*_*ndi 22

这是问题的真正原因:

引起:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:通信链路故障

您有数据库通信链接问题.确保您的应用程序具有对数据库的网络访问权限(并且防火墙不会阻止数据库的端口).

  • 对于后代,当我在开发环境中重新启动计算机并且我的数据库没有运行时,我每个月都会遇到这个问题.我希望当他们犯同样的愚蠢错误时,这可以帮助别人. (5认同)

Shi*_*ami 6

localhost在源 URL 中遇到了同样的问题。我用127.0.0.1而不是localhost.