Database conection

I have an oracle database and I’m trying to connect it to my oracle database in different ways and it doesn’t work, sonarqube continues to use the embedded database, I configured sonar properties and nothing. The command line that I use is the following.

docker run -d --name sonarqube -p 9000:9000 -p 9092:9092 -e sonar.jdbc.username=system -e sonar.jdbc.password=Carrasco1. -e sonar.jdbc.url=jdbc:oracle:thin:@//172.20.10.2:1521/sonar sonarqube

We have documentation for this :wink:

$> docker run -d --name sonarqube \
    -p 9000:9000 \
    -e SONAR_JDBC_URL=... \
    -e SONAR_JDBC_USERNAME=... \
    -e SONAR_JDBC_PASSWORD=... \

Hello Colin, I followed those steps and it doesn’t work, it keeps connecting me to the embedded database, could you help me please?

└─# docker run -d --name sonarqube
-p 9000:9000
-e SONAR_JDBC_URL=jdbc:oracle:thin@172.20.10.2:1521:sonar
-e SONAR_JDBC_USERNAME=system
-e SONAR_JDBC_PASSWORD=Carrasco1.
-v sonarqube_data:/opt/sonarqube/data
-v sonarqube_extensions:/opt/sonarqube/extensions
-v sonarqube_logs:/opt/sonarqube/logs
sonarqube
Unable to find image ‘sonarqube:latest’ locally
latest: Pulling from library/sonarqube
3f94e4e483ea: Pull complete
857412f02e8d: Pull complete
90f618ea570e: Pull complete
a2665c89972d: Pull complete
4cddf28676ca: Pull complete
3b98eef18a68: Pull complete
Digest: sha256:a5f8de802790c87259d834219346804de39466d8349d03a87f35dde7764468a7
Status: Downloaded newer image for sonarqube:latest
d8dee0d3efe63f2406d9c8b8394d393dc9f8fcee98f0aa8e4c6785dd0562e7c4

┌──(root㉿kali)-[/var/lib/docker/volumes/sonarqube_extensions]
└─# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

┌──(root㉿kali)-[/var/lib/docker/volumes/sonarqube_extensions]
└─# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

┌──(root㉿kali)-[/var/lib/docker/volumes/sonarqube_extensions]
└─# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d8dee0d3efe6 sonarqube “/opt/sonarqube/dock…” 22 seconds ago Exited (1) 21 seconds ago sonarqube

Did you leave out the \ from the end of each line on purpose?

Hello Colin, good day, not by itself the steps I did were the following:

$> docker volume create --name sonarqube_data
$> docker volume create --name sonarqube_logs
$> docker volume create --name sonarqube_extensions

to. Start the SonarQube container with the embedded H2 database:

$ docker run --rm
-p 9000:9000
-v sonarqube_extensions:/opt/sonarqube/extensions
sonarqube

b. Exit once SonarQube has started properly. (after performing step a, I stop the service with control + c

c. Copy the Oracle JDBC driver into sonarqube_extensions/jdbc-driver/oracle. (here I copy my driver ojdbc8-12.2.0.1.jar)

  1. Run the image with your database properties defined using the -e environment variable flag:

docker run -d --name sonarqube
-p 9000:9000
-e SONAR_JDBC_URL=jdbc:oracle:thin@172.20.10.2:1521:sonar
-e SONAR_JDBC_USERNAME=system
-e SONAR_JDBC_PASSWORD=Carrasco1.
-v sonarqube_data:/opt/sonarqube/data
-v sonarqube_extensions:/opt/sonarqube/extensions
-v sonarqube_logs:/opt/sonarqube/logs
sonarqube

However, after this the sonarqube does not wake me up at all, by itself if it has the ( \ Barra invertida o barra descendente) I don’t know why it doesn’t appear when I publish it

Okay, so to be clear it doesn’t appear connected to the H2 database, but actually doesn’t come up at all?

I already managed to get my jdbc driver to recognize me; However, it appears that I cannot connect to the database, it should be noted that when I ping or telnet to the ip x.x.x.x:1521 it does connect from my server where I have my sonarqube docker up. what could happen?

Do you have a precise stacktrace from the logs that indicate the connection can’t be made?