moved database connect to init