Gradle and Sonar plugin throws BadDatabaseVersion!


(Daniel Mühlbachler) #1

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…

Thanks!


(Peter Niederwieser) #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.


(Daniel Mühlbachler) #3

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?)


(Peter Niederwieser) #4

That leaves the JDBC driver name. See http://gradle.org/docs/current/groovydoc/org/gradle/api/plugins/sonar/model/SonarDatabase.html#driverClassName


(Daniel Mühlbachler) #5

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


(Peter Niederwieser) #6

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.


(Daniel Mühlbachler) #7

My Gradle config is: http://pastebin.com/jey1uN3b 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!


(René Groeschke) #8

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


(Daniel Mühlbachler) #9

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