connect db and input