Sonar 无法连接到 mySQL 总是尝试 jdbc:h2:tcp://localhost/sonar [英] Sonar fails to connect to mySQL always tries jdbc:h2:tcp://localhost/sonar
问题描述
今天早上我下载了 Sonar 最新版本.行家 3.2.5,mysql.声纳设置正确,我的网站在 9000 工作正常,所有表都在 mySql 中正确创建.我已使用以下内容更新了我的 .m2/settings.xml
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
<profiles>
<profile>
<id>sonar</id>
<properties>
<sonar.jdbc.url>jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true</sonar.jdbc.url>
<sonar.jdbc.username>myuser</sonar.jdbc.username>
<sonar.jdbc.password>mypassword</sonar.jdbc.password>
<sonar.host.url>http://localhost:9000</sonar.host.url>
</properties>
</profile>
</profiles>
我试过 mvn sonar:sonar,我总是得到
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
我什至用
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
我在这里访问了几个线程Sonar 无法连接到数据库我知道我所做的应该使这个项目正常工作,但事实并非如此
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
感谢您的帮助
推荐答案
我解决了.我需要在 settings.xml 中添加以下内容
I solved it. I needed to add the following in the settings.xml
<activation>
<activeByDefault>true</activeByDefault>
</activation>
这篇关于Sonar 无法连接到 mySQL 总是尝试 jdbc:h2:tcp://localhost/sonar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!