Add db connection to view and controller