added db connect function to app constructor