How Do You Get SonarQube to Use a New Database Connection and Change It from the Previous One It Was Working with?

Problem scenario
You try to start an old SonarQube instance but with a new database connection. In the web.log file you see a message like this: "Can not connect to database. Please check connectivity and settings." What should you do?

Solution
Go to sonar.properties. Find the connection string for the new database. It should look something like this:

sonar.jdbc.url=jdbc:oracle://FQDN:1521:XE

The default port for Oracle databases is 1521. Are the last three characters "/XE"? Change the "/" to ":". XE stands for Express Edition. Some sources indicate that the format should be hostname:portnumber:sid

The "sid" (or service name) for Oracle is often "XE" (which stands for Express Edition). The character separating the TCP port number and the sid should be a colon ":"

Details and reference information can be found in these links:
https://docs.oracle.com/cd/E11882_01/appdev.112/e13995/oracle/jdbc/OracleDriver.html
https://docs.oracle.com/cd/B25329_01/doc/appdev.102/b25320/getconn.htm

Leave a comment

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