db: added multiple databases support