writing path to database