天天看点

sonar.jdbc.url mysql,声纳无法连接到MySQL总是尝试jdbc:h2:tcp:// localhost / sonar

sonar.jdbc.url mysql,声纳无法连接到MySQL总是尝试jdbc:h2:tcp:// localhost / sonar

This morning I have downloaded Sonar latest version. maven 3.2.5, mysql.

Sonar setup went correctly and I have the web site at 9000 working fine and all tables correctly created in mySql.

I have updated my .m2/settings.xml with the following

sonar

jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true

myuser

mypassword

http://localhost:9000

I tried mvn sonar:sonar, I always get

INFO: Work directory: /home/salam/git/spring-petclinic/target/sonar

INFO: SonarQube Server 5.1

[INFO] [00:11:25.410] Load global repositories

[INFO] [00:11:26.307] Load global repositories (done) | time=905ms

[INFO] [00:11:26.317] Server id: 20150406220059

[INFO] [00:11:26.326] User cache: /home/salam/.sonar/cache

[INFO] [00:11:26.360] Install plugins

[INFO] [00:11:26.539] Install JDBC driver

[INFO] [00:11:26.554] Create JDBC datasource for jdbc:h2:tcp://localhost/sonar

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

I even updated sonnar-project.properties with

sonar.jdbc.driverClassName=com.mysql.jdbc.Driver

sonar.sourceEncoding=UTF-8

sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8

sonar.jdbc.username=myuser

sonar.jdbc.password=mypassword

No way, always getting the same error and sonar can not go through

I visited a couple of threads here Sonar fails to connect to database

I understand that what I have doen should make this project works fine but this is not the case

Thanks for your help

解决方案

I solved it. I needed to add the following in the settings.xml

true