Gradle and Sonar plugin throws BadDatabaseVersion!

I always get the error “The current batch process and the configured remote server do not share the same DB configuration.” when trying to execute the sonarAnalyze task.

Has anybody else this problem or ideas? I am using Gradle 1.3 and Sonar 3.3.2…


Sounds like you haven’t configured ‘sonar.database’ in the build script, or haven’t configured it correctly. Note that Sonar 3.3 changed the default database settings, so Gradle’s defaults won’t work for that version.

In my build script I specify the DB URL (it is equal to the Sonar DB URL), the username and password for the connection. Imo, I should have configured the database connection equal - does it make a difference which MySQL Connector version is used? (If so, which one is used by Gradle?)

That leaves the JDBC driver name. See

Driver class name is also equal in Gradle and Sonar “com.mysql.jdbc.Driver”

The Sonar client uses the DB information specified in the Gradle build script. The Sonar server uses the DB information configured in the Sonar server.

If you think that you have configured ‘sonar.database’ correctly, and still get this error, I recommend to take this to the Sonar mailing list.

My Gradle config is: and the used DB URL in Sonar itself is “jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true”

In fact, I don’t see any difference but maybe I’ve overseen anything…

OK, thanks for your help anyway!

hello, your db url specifies localhost as sonar db server. I think thats the problem, as the localhost is obviously different on the machine(s) where you execute your buld script and on the sonar server.

cheers, Rene

The server is the same. In fact, it shouldn’t make a difference.