Java Hibernate/C3P0 error: “Could not obtain connection metadata. An attempt by a client to checkout a Connection has timed out.”

狂风中的少年 提交于 2019-12-04 00:09:17

If you have set C3P0's "checkoutTimeout" property to something other than 0 you might be timing out too quickly (that was my problem, solution: bumped it to 2000 milliseconds from 500).

Alternatively, there's a workaround for this warning:

Set the hibernate.temp.use_jdbc_metadata_defaults property to false.

Found this in http://www.docjar.com/html/api/org/hibernate/cfg/SettingsFactory.java.html, though there may be side effects of not having Hibernate extract JDBC Metadata defaults.

Actually that's not even an authentication error. Is MySQL even running or bound to localhost?

does telnet 127.0.0.1 3306 work? if so, install the mysql client on the box and try

mysql --user=root --ip=127.0.0.1 and see what happens

Check if you can connect to the gamelog mysql database on the command line with the root user and no password (!). As a side note, I'd recommend to set a password for root and to use a different account to connect to the database from your application, but that's another story.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!