# Database-related issues

The first thing to do is [checking-server-logs](https://docs.sonarsource.com/sonarqube-server/10.8/server-upgrade-and-maintenance/troubleshooting/checking-server-logs "mention").

## Timeout issues when setting up Database Connection Pool <a href="#time-out-database-connection-pool" id="time-out-database-connection-pool"></a>

In some configurations when there is a firewall between SonarQube Server and the data you may experience timeout issues. The firewall may interrupt idle DB connections after a specific timeout which can lead to resetting connections. See also **Issues with MS SQL Server connection** below.

You can customize the [HikariCP](https://github.com/brettwooldridge/HikariCP#gear-configuration-knobs-baby) settings to the defaults listed below to avoid timeout isssues.

```css-79elbk
sonar.jdbc.idleTimeout=600000
sonar.jdbc.keepaliveTime=300000
sonar.jdbc.maxLifetime=1800000
sonar.jdbc.validationTimeout=5000
```

Additionally, it is now possible to configure HikariCP properties described [here](https://github.com/brettwooldridge/HikariCP#frequently-used) using the following naming convention: `sonar.jdbc.{HikariCP property name}`.

## Issues with MS SQL Server connection <a href="#hikaricp-connection-issue" id="hikaricp-connection-issue"></a>

HikariCP may get exhausted from connections causing SonarQube Server to be unresponsive. In this case, the error may display something like `HikariPool-1 - Connection is not available` or `HikariPool-1 - Cannot acquire connection from data source`.

In this case, customize the [HikariCP](https://github.com/brettwooldridge/HikariCP#gear-configuration-knobs-baby) settings as follows:

```css-79elbk
sonar.jdbc.minIdle=25
sonar.jdbc.maxActive=25
sonar.jdbc.maxLifetime=0
sonar.jdbc.maxWait=30000
```

## Oracle JDBC driver blocked <a href="#oracle-driver-blocked" id="oracle-driver-blocked"></a>

See **If using an Oracle database** in [linux](https://docs.sonarsource.com/sonarqube-server/10.8/setup-and-upgrade/pre-installation/linux "mention").

## Connectivity issue between SonarQube Server and MS SQL Server <a href="#connectivity-issue" id="connectivity-issue"></a>

If the TCP/IP connection is refused, make sure that Named Pipes and TCP/IP connections are enabled on your SQL Server.

## Duplicate keys during background task processing after upgrading to RHEL 8 <a href="#duplicate-keys-after-upgrade" id="duplicate-keys-after-upgrade"></a>

If you performed an in-place OS upgrade to RHEL 8 or [with any similar operating systems](https://wiki.postgresql.org/wiki/Locale_data_changes#What_Linux_distributions_are_affected) and you use PostgreSQL, the new version of glibc may affect locale data changes.

To prevent this, avoid in-place OS upgrades and perform dump-and-restore of the database to an already-upgraded OS.

To correct the issue, restore from a known good backup copy of the database and perform the maintenance steps:

```css-79elbk
VACUUM FULL;
REINDEX DATABASE <database-name>;
ANALYZE;
```

## Related pages <a href="#related-pages" id="related-pages"></a>

* [checking-server-logs](https://docs.sonarsource.com/sonarqube-server/10.8/server-upgrade-and-maintenance/troubleshooting/checking-server-logs "mention")
* [performance-issues](https://docs.sonarsource.com/sonarqube-server/10.8/server-upgrade-and-maintenance/troubleshooting/performance-issues "mention")
* [elasticsearch](https://docs.sonarsource.com/sonarqube-server/10.8/server-upgrade-and-maintenance/troubleshooting/elasticsearch "mention")
* [other-issues](https://docs.sonarsource.com/sonarqube-server/10.8/server-upgrade-and-maintenance/troubleshooting/other-issues "mention")


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sonarsource.com/sonarqube-server/10.8/server-upgrade-and-maintenance/troubleshooting/database-related-issues.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
