change session to database