# DB change for Pritunl

**URL:** <https://forum.pritunl.com/t/db-change-for-pritunl/2273>\
**Category:** Pritunl VPN\
**Tags:** pritunl\
**Created:** [August 13, 2024, 4:52pm UTC](https://forum.pritunl.com/t/db-change-for-pritunl/2273 "2024-08-13T16:52:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikep2468](https://forum.pritunl.com/user_avatar/forum.pritunl.com/mikep2468/32/911_2.png) [@mikep2468](https://forum.pritunl.com/u/mikep2468)\
**Post date:** [August 13, 2024, 4:52pm UTC](https://forum.pritunl.com/t/db-change-for-pritunl/2273/1 "2024-08-13T16:52:09Z")

</div>

Hi  
I’m trying to redeploy my instance of pritunl VPN but can’t get new server to connect to new DB, getting error: No default database name defined or provided

More Info  
I have a working setup with an Ubuntu VM in GCP connecting to a Mongo cloud DB. I was required to perform a DR test so I have re-deployed the server from backup and also re-deployed the DB from backup. I’ve then updated /etc/pritunl.conf to use the URI of the new DB but it will not work. the /var/log/pritunl.log contains

```auto
    raise ConfigurationError("No default database name defined or provided.")
pymongo.errors.ConfigurationError: No default database name defined or provided.

```

I’ve connected directly to the DB using the Mongo shell tools on the server so I know I have access. The server has even updated the old/live database (by mistake before i updated conf file ) as my existing system shows name of new server (not great but still works). I just can’t get new server to talk to new DB. pritunl.conf file has:  
`"mongodb_uri": "mongodb+srv://USER:PASSWORD@DB-CLUSTER.crtdx.mongodb.net/?retryWrites=true&w=majority",`

Any suggestions anyone?  
Mike

---

<div class="post-metadata">

**Author:** ![zach](https://forum.pritunl.com/user_avatar/forum.pritunl.com/zach/32/1105_2.png) [@zach](https://forum.pritunl.com/u/zach)\
**Post date:** [August 13, 2024, 8:51pm UTC](https://forum.pritunl.com/t/db-change-for-pritunl/2273/2 "2024-08-13T20:51:53Z")

</div>

There should be a database name as the first path component in the URI `mongodb+srv://USER:PASSWORD@DB-CLUSTER.crtdx.mongodb.net/pritunl?retryWrites=true&w=majority`. Until the next release with the new pymongo 4.0 library you may also need to use the legacy URI that includes each host.

---

<div class="post-metadata">

**Author:** ![mikep2468](https://forum.pritunl.com/user_avatar/forum.pritunl.com/mikep2468/32/911_2.png) [@mikep2468](https://forum.pritunl.com/u/mikep2468)\
**Post date:** [August 13, 2024, 9:26pm UTC](https://forum.pritunl.com/t/db-change-for-pritunl/2273/3 "2024-08-13T21:26:54Z")

</div>

Hi  
thanks for the response, so I got the legacy URI from Mongo cloud and updated the pritunl.conf file. it’s now pretty much the same as my live working system but with different DB-CLUSTER-NAME but it still get same error after restarting pritunl service. ☹

` "mongodb_uri": "mongodb://USER:PASSWORD@DB-CLUSTER-NAME-shard-00-00.crtdx.mongodb.net:27017,DB-CLUSTER-NAME-shard-00-01.crtdx.mongodb.net:27017,DB-CLUSTER-NAME-shard-00-02.crtdx.mongodb.net:27017/?ssl=true&replicaSet=atlas-XXX-shard-0&authSource=admin&retryWrites=true&w=majority",`

logs still show

```auto
  File "/usr/lib/pritunl/usr/lib/python3.9/site-packages/pymongo/mongo_client.py", line 2247, in get_default_database
    raise ConfigurationError("No default database name defined or provided.")
pymongo.errors.ConfigurationError: No default database name defined or provided.
[local][2024-08-13 21:10:21,618][INFO] Stopping server

```

any more advice?  
Thanks

---

<div class="post-metadata">

**Author:** ![zach](https://forum.pritunl.com/user_avatar/forum.pritunl.com/zach/32/1105_2.png) [@zach](https://forum.pritunl.com/u/zach)\
**Post date:** [August 16, 2024, 8:12pm UTC](https://forum.pritunl.com/t/db-change-for-pritunl/2273/4 "2024-08-16T20:12:47Z")

</div>

That URI is still missing the database name use `mongodb://USER:PASSWORD@DB-CLUSTER-NAME-shard-00-00.crtdx.mongodb.net:27017,DB-CLUSTER-NAME-shard-00-01.crtdx.mongodb.net:27017,DB-CLUSTER-NAME-shard-00-02.crtdx.mongodb.net:27017/pritunl?ssl=true&replicaSet=atlas-XXX-shard-0&authSource=admin&retryWrites=true&w=majority`
