Can't connect to MySQL from webapp in Ubuntu
I have a MySQL database I'm able to connect via the command prompt and the MySQL administration tool but using the same credentials in a Web application in a Tomcat server on the same server gives me this error:
javax.servlet.ServletException
:org.apache.commons.dbcp.SQLNestedException
: Cannot createPoolableConnectionFactory
(Could not create connection to database server. Attempted reconnect 3 times. Giving up.)
Which I recognize as an incorrect credentials issue. I checked that the MySQL server is listening on port 3306 using netstat. I don't have the mysql ro开发者_如何转开发ot credentials but I created a new account and granted all priviledges to it and are the ones used to connect both using the command prompt and the MySQL admin tool.
Turned out to be a caching issue. Disabled the context caching in the web application in order to "see" the changes. Windows doesn't show this behavior/issue.
精彩评论