database switching and user login completed