check_pub_key needs to connect to database