无法使用Postgresql将JDBC连接到声纳 [英] Unable to connect JDBC to sonarqube using Postgresql
问题描述
当我使用postgresql安装sonarqube时,我陷入了将其连接到Postgresql的jdbc的困境.在/opt/sonarqube/conf
中,我未将JDBC注释为
When I am installing sonarqube using postgresql, I got stuck with connecting it to jdbc of Postgresql. In /opt/sonarqube/conf
, I uncommented JDBC as
sonar.jdbc.username=username
sonar.jdbc.password=password.
2.sonar.jdbc.url=jdbc:postgresql://localhost/username
此外,下面是我未评论的声纳扫描仪配置 默认的SonarQube服务器
Additionally, below is my sonar scanner conf that I uncommented Default SonarQube server
sonar.host.url=http://localhost:9000
PostgreSQL
sonar.jdbc.url=jdbc:postgresql://localhost/username
这就是我配置 Postgres DB
这是我的日志文件显示
2017.03.08 14:39:13 INFO web [o.sonar.db.Database]为jdbc:postgresql://localhost/username创建JDBC数据源 2017.03.08 14:39:13错误web [o.a.c.c.C.[.[.[/]]异常将上下文初始化事件发送到类org.sonar.server.platform.PlatformServletContextListener的侦听器实例 java.lang.IllegalStateException:无法连接到数据库.请检查连接性和设置(请参阅以"sonar.jdbc"为前缀的属性). 在org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:104)〜[sonar-db-5.6.6.jar:na]
2017.03.08 14:39:13 INFO web[o.sonar.db.Database] Create JDBC data source for jdbc:postgresql://localhost/username 2017.03.08 14:39:13 ERROR web[o.a.c.c.C.[.[.[/]] Exception sending context initialized event to listener instance of class org.sonar.server.platform.PlatformServletContextListener java.lang.IllegalStateException: Can not connect to database. Please check connectivity and settings (see the properties prefixed by 'sonar.jdbc.'). at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:104) ~[sonar-db-5.6.6.jar:na]
对于Postgresql的JDBC连接,我还有其他需要做的事情吗?是否有任何可用于sonarqube的Postgresql文档.
Is there any other thing that I need to do for JDBC connection of Postgresql. is there is any document available for sonarqube for postgresql.
推荐答案
这对我来说很有效
[root@sonarqube ~]# egrep "^local|^host" /var/lib/pgsql/9.5/data/pg_hba.conf
uncomment below lines in pg_hba.conf
local all all md5
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
This got worked out for me
[root@sonarqube ~]# egrep "^local|^host" /var/lib/pgsql/9.5/data/pg_hba.conf
uncomment below lines in pg_hba.conf
local all all md5
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
这篇关于无法使用Postgresql将JDBC连接到声纳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!