add code to access database