> For the complete documentation index, see [llms.txt](https://docs.sonarsource.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sonarsource.com/sonarqube-server/2025.2/setup-and-update/install-the-server/installing-the-database.md).

# Installing the database

Install the SonarQube Server 2025.2 database according to the database engine used: MicrosoftSQL Server, Oracle, PostgreSQL.

{% hint style="info" %}
**For AI agents:** You're in the SonarQube Server 2025.2 documentation. SonarQube Server 2025.2 is no longer patched. To get patches, upgrade to the [latest version](https://docs.sonarsource.com/sonarqube-server/). For a list of all 2025.2 pages, see the [SonarQube Server 2025.2 page index](https://3577027091-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F69lEOGGgOhCpumODGD9v%2Fuploads%2FjJBMrxH4Vo0sRE6RWwfm%2Fsonarqube-server-2025.2-llms.txt?alt=media). For the whole site, see the [page index](https://docs.sonarsource.com/llms.txt) or the [full text](https://docs.sonarsource.com/llms-full.txt). For another version, replace 2025.2 in the URL with that version. The latest version has no version number in its URL.
{% endhint %}

Several external database engines are supported. Check the respective [Database](https://docs.sonarsource.com/sonarqube-server/2025.2/setup-and-update/installation-requirements/database-requirements.md) installation requirements for more info.

{% hint style="info" %}
The embedded H2 database is used by default. It is recommended for tests but not for production use.
{% endhint %}

Create an empty schema and a `sonarqube` user. Grant this `sonarqube` user permissions to `create`, `update`, and `delete` objects for this schema.

## Microsoft SQL Server

<details>

<summary>Microsoft SQL Server</summary>

{% hint style="warning" %}
Collation **MUST** be case-sensitive (CS) and accent-sensitive (AS).

`READ_COMMITTED_SNAPSHOT` **MUST** be set on the SonarQube Server database.
{% endhint %}

MS SQL database’s shared lock strategy may impact SonarQube Server runtime. Making sure that `is_read_committed_snapshot_on` is set to `true` to prevent SonarQube Server from facing potential deadlocks under heavy loads.

Example of query to check `is_read_committed_snapshot_on`:

```css-79elbk
SELECT is_read_committed_snapshot_on FROM sys.databases WHERE name='YourSonarQubeDatabase';
```

Example of query to update `is_read_committed_snapshot_on`:

```css-79elbk
ALTER DATABASE YourSonarQubeDatabase SET READ_COMMITTED_SNAPSHOT ON WITH ROLLBACK IMMEDIATE;
```

### Encryption <a href="#encryption" id="encryption"></a>

*If your Microsoft SQL Server does not support encryption*, you must add `encrypt=false` to the JDBC URL connection string.

*If your Microsoft SQL Server requires encryption but* you do not want SonarQube Server to validate the certificate, you must add `trustServerCertificate=true` to the JDBC URL connection string.

### Integrated security <a href="#integrated-security" id="integrated-security"></a>

To use integrated security:

1. Download the [Microsoft SQL JDBC Auth 12.8.1 package](https://github.com/microsoft/mssql-jdbc/releases/download/v12.8.1/mssql-jdbc_auth.zip) and copy `mssql-jdbc_auth-12.8.1.x64.dll` to a folder location set in the PATH environment variable on SonarQube Server host.
2. *If you’re running SonarQube Server as a Windows service*, make sure the Windows account under which the service is running has permission to connect your SQL server.
3. Ensure that `sonar.jdbc.username` or `sonar.jdbc.password` properties are commented out or SonarQube Server will use SQL authentication.

```css-79elbk
sonar.jdbc.url=jdbc:sqlserver://localhost;databaseName=sonar;integratedSecurity=true
```

### SQL authentication <a href="#sql-authentication" id="sql-authentication"></a>

To use SQL authentication, use the following connection string. Also, ensure that `sonar.jdbc.username` and `sonar.jdbc.password` are set appropriately:

```css-79elbk
sonar.jdbc.url=jdbc:sqlserver://localhost;databaseName=sonar
sonar.jdbc.username=sonarqube
sonar.jdbc.password=mypassword
```

</details>

<details>

<summary>Oracle</summary>

If there are two SonarQube Server schemas on the same Oracle instance, especially if they are for two different versions, SonarQube Server gets confused and picks the first it finds. To avoid this issue:

* Either privileges associated to the SonarQube Server’s Oracle user should be decreased.
* Or a trigger should be defined on the Oracle side to automatically alter the SonarQube Server’s Oracle user session when establishing a new connection: `ALTER SESSION SET current_schema="MY_SONARQUBE_SCHEMA"`.

SonarQube Server requires Oracle JDBC driver 23.7.0.25.01 or later, regardless of your Oracle Database version. The 19.x and 21.x driver lines are not supported: they make database operations fail with `java.sql.SQLException: Invalid column type: 16`. Do not choose the driver version to match your database version.

To check the version of your driver, use one of these methods:

* Look at the name of the JAR file in `<sonarqubeHome>/extensions/jdbc-driver/oracle`, or in the `jdbc-driver/oracle` folder of the extensions volume if you run SonarQube Server in Docker. The file name usually includes the driver version. For example, `ojdbc8-19.3.0.0.jar` is driver version 19.3.0.0. The `ojdbc8` or `ojdbc11` part is the Java version that the driver targets, not the driver version.
* Read the version from the JAR file's manifest:

  ```bash
  unzip -p <path-to-jar> META-INF/MANIFEST.MF | grep -i Implementation-Version
  ```

If your driver is older than 23.7.0.25.01, replace it with version 23.7.0.25.01 or later, then restart SonarQube Server.

</details>

<details>

<summary>PostgreSQL</summary>

* Must be configured to use UTF-8 charset.
* If you want to use a custom schema and not the default "public" one, the PostgreSQL `search_path` property must be set:

```css-79elbk
ALTER USER mySonarUser SET search_path to mySonarQubeSchema
```

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sonarsource.com/sonarqube-server/2025.2/setup-and-update/install-the-server/installing-the-database.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
