# Nexus keeps using H2 database after migrating from H2 to PostgreSQL

**URL:** <https://community.sonatype.com/t/nexus-keeps-using-h2-database-after-migrating-from-h2-to-postgresql/14569>\
**Category:** Sonatype Nexus Repository\
**Created:** [March 10, 2025, 4:25pm UTC](https://community.sonatype.com/t/nexus-keeps-using-h2-database-after-migrating-from-h2-to-postgresql/14569 "2025-03-10T16:25:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hooman\_Valibeigi](https://avatars.discourse-cdn.com/v4/letter/h/5e9695/32.png) [@Hooman\_Valibeigi](https://community.sonatype.com/u/Hooman_Valibeigi)\
**Post date:** [March 10, 2025, 4:25pm UTC](https://community.sonatype.com/t/nexus-keeps-using-h2-database-after-migrating-from-h2-to-postgresql/14569/1 "2025-03-10T16:25:03Z")

</div>

I am trying to migrate the H2 database to an external PostgreSQL instance. DB-migrator executes without any errors and I can see the tables created in the target PostgreSQL database under schema ‘public’.  
I also created `/opt/sonatype/sonatype-work/nexus3/etc/fabric/nexus-store.properties` file with the following content:

```auto
username=nexus
password=password
jdbcUrl=jdbc\:postgresql\://host/nexus

```

And added the following line to `/opt/sonatype/sonatype-work/nexus3/etc/nexus.properties`

```auto
nexus.datastore.enabled=true

```

After starting nexus, it still uses the H2 database and does not detect the PostgreSQL configuration. From nexus.log you can find these logs:

```auto
2025-03-09 21:44:17,897+0330 INFO [FelixStartLevel] *SYSTEM org.sonatype.nexus.extender.NexusLifecycleManager - Start STORAGE
2025-03-09 21:44:17,908+0330 INFO [FelixStartLevel] *SYSTEM org.sonatype.nexus.datastore.DataStoreConfigurationDefaultSource - Loaded 'nexus' data store configuration defaults (Embedded H2)
2025-03-09 21:44:17,939+0330 INFO [FelixStartLevel] *SYSTEM com.zaxxer.hikari.HikariDataSource - nexus - Starting...
2025-03-09 21:44:18,167+0330 INFO [FelixStartLevel] *SYSTEM com.zaxxer.hikari.HikariDataSource - nexus - Start completed.
2025-03-09 21:44:18,168+0330 INFO [FelixStartLevel] *SYSTEM org.sonatype.nexus.datastore.mybatis.MyBatisDataStore - nexus - Loading MyBatis configuration from /opt/sonatype/nexus/etc/fabric/mybatis.xml
2025-03-09 21:44:18,234+0330 INFO [FelixStartLevel] *SYSTEM org.sonatype.nexus.datastore.mybatis.MyBatisDataStore - nexus - MyBatis databaseId: H2

```

Also tried setting database configuration via VM options but to no avail.

Nexus version: 3.75.1-01  
DB migrator: 3.75.1-01

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![mpiggott](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mpiggott](https://community.sonatype.com/u/mpiggott)\
**Post date:** [March 11, 2025, 2:16pm UTC](https://community.sonatype.com/t/nexus-keeps-using-h2-database-after-migrating-from-h2-to-postgresql/14569/2 "2025-03-11T14:16:51Z")

</div>

Prior to Nexus Repository 3.77 you need a PRO license installed in order to use PostgreSQL.

With 3.77+ as part of the Community Edition Nexus can use PostgreSQL without a PRO license.
