How Do You Troubleshoot SonarQube Not Working when the Logs Have a Comment about Not Being Able to Connect to the Database?

Problem scenario
In the SonarQube logs you get an error "java.lang.IllegalStateException: Can not connect to database.  Please check connectivity and settings (see the properties prefixed by 'sonar.jdbc')"

How do you troubleshoot this error?

Solution
1.  Verify you can ping the hostname.  

2.  Test the port with nmap (e.g., "nmap -p 1521 <databaseFQDN>" where <databaseFQDN> is the hostname of the database and 1521 is the port you configured in the stanza with "sonar.jdbc").  An intermediate firewall blocking connectivity over a specific port could cause problem.

3.  If the database is an Oracle database, test the credentials you were given.  If you do not know, see this posting.  Did you include a SID in the connection string?

Leave a comment

Your email address will not be published. Required fields are marked *