Fix database configuration when setup through session

[fixes #3335]