Cannot connect to database

What happened?

A database error occurred, probably because your database connection is misconfigured. You will have to fix this problem and then restart or redeploy Roller before you can proceed. Here's what happened when Roller tried to establish a connection:

  • SUCCESS: Got parameters. Using configuration type JDBC_PROPERTIES
  • -- Using JDBC driver class: com.mysql.jdbc.Driver
  • -- Using JDBC connection URL: jdbc:mysql://localhost:3306/rollerdb?autoReconnect=true&useUnicode=true&characterEncoding=utf-8&mysqlEncoding=utf8
  • -- Using JDBC username: caesar
  • -- Using JDBC password: [hidden]
  • SUCCESS: loaded JDBC driver class [com.mysql.jdbc.Driver]
  • ERROR: unable to obtain database connection. Likely problem: bad connection parameters or database unavailable.

Why did that happen?

In case the clues above are not enough to help you figure out what is going wrong, here are some more details. The root cause of the problem is an exception of type [com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException]

To help you debug the problem, here is the stack trace for that exception:

    [com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Server connection failure during transaction. Due to underlying exception: 'com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Access denied for user 'caesar'@'%' to database 'rollerdb''.

** BEGIN NESTED EXCEPTION ** 

com.mysql.jdbc.exceptions.MySQLSyntaxErrorException
MESSAGE: Access denied for user 'caesar'@'%' to database 'rollerdb'

STACKTRACE:

com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Access denied for user 'caesar'@'%' to database 'rollerdb'
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:885)
	at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3421)
	at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1247)
	at com.mysql.jdbc.Connection.createNewIO(Connection.java:2924)
	at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
	at java.sql.DriverManager.getConnection(DriverManager.java:664)
	at java.sql.DriverManager.getConnection(DriverManager.java:208)
	at org.apache.roller.weblogger.business.DatabaseProvider.getConnection(DatabaseProvider.java:180)
	at org.apache.roller.weblogger.business.DatabaseProvider.<init>(DatabaseProvider.java:144)
	at org.apache.roller.weblogger.business.startup.WebloggerStartup.prepare(WebloggerStartup.java:169)
	at org.apache.roller.weblogger.ui.core.RollerContext.contextInitialized(RollerContext.java:140)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5524)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1245)
	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1895)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)


** END NESTED EXCEPTION **


Attempted reconnect 3 times. Giving up.
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:888)
	at com.mysql.jdbc.Connection.createNewIO(Connection.java:2997)
	at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
	at java.sql.DriverManager.getConnection(DriverManager.java:664)
	at java.sql.DriverManager.getConnection(DriverManager.java:208)
	at org.apache.roller.weblogger.business.DatabaseProvider.getConnection(DatabaseProvider.java:180)
	at org.apache.roller.weblogger.business.DatabaseProvider.<init>(DatabaseProvider.java:144)
	at org.apache.roller.weblogger.business.startup.WebloggerStartup.prepare(WebloggerStartup.java:169)
	at org.apache.roller.weblogger.ui.core.RollerContext.contextInitialized(RollerContext.java:140)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5524)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1245)
	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1895)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)]