Fail to connect to database PGSQL

Good morning, please your support to solve the following conflict, when raising sonarqube the WEB.LOG the following is shown: Fail to connect to database

2020.08.13 23:10:46 INFO web[o.s.p.ProcessEntryPoint] Starting web
2020.08.13 23:10:48 INFO web[o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2020.08.13 23:10:52 INFO web[o.e.p.PluginsService] no modules loaded
2020.08.13 23:10:52 INFO web[o.e.p.PluginsService] loaded plugin [org.elasticsearch.join.ParentJoinPlugin]
2020.08.13 23:10:52 INFO web[o.e.p.PluginsService] loaded plugin [org.elasticsearch.percolator.PercolatorPlugin]
2020.08.13 23:10:52 INFO web[o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2020.08.13 23:10:56 INFO web[o.s.s.e.EsClientProvider] Connected to local Elasticsearch: []
2020.08.13 23:10:56 INFO web[o.s.s.p.LogServerVersion] SonarQube Server / / cd30425aa0b4e62c39b57c81d64be16e365f6d83
2020.08.13 23:10:56 INFO web[o.sonar.db.Database] Create JDBC data source for jdbc:postgresql://localhost:/Sonarqube?currentSchema=Sonar
2020.08.13 23:10:56 WARN web[o.postgresql.Driver] JDBC URL invalid port number:
2020.08.13 23:10:56 ERROR web[o.s.s.p.Platform] Web server startup failed
java.lang.IllegalStateException: Fail to connect to database

Hey there.

This is your sonar.jdbc.url


This is the error you’re getting:

JDBC URL invalid port number:

You either need to add a port number (PostgreSQL usually is on 5432!) or remove the : after localhost

I already corrected him: sonar.jdbc.url
but the same conflict still exists.
I attach the log files:es.log (3.6 KB) sonar.log (14.8 KB) web.log (4.4 KB)

Hi @beatriz ,

but this time it’s another error message :wink:

no se ha seleccionado ningún esquema dentro del cual crear

if google translate is doing its job correctly it means that the schema you defined is not available within your postgresql database. there is a section in that explains this:

By default the schema named “public” is used. It can be overridden with the parameter “currentSchema”.

try to remove the ?currentSchema=Sonar part in the jdbc url

hope that helps

Hi Tobias

It is correct if SonarQube was successfully raised with the aforementioned, but what is needed is that it also connect to the scheme, any suggestions please

Here I show you the creation of the database and schema in PGSQL:

I can only assume that you have defined the schema public as default somewhere within the template that has been used in order to create the database.

I have just created a new Database, removed the public schema from said database and added a new one. postgres should fall back to the schema that is defined in the database if the default one is deleted. if you have data in your database already you should probably create a backup before doing something like this.

Thank you very much, the information helped me a lot.

That’s great to hear. So your instance is up and running?

If it is working correctly, thank you again

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.