added support to attach an existing db connection, remove invalid require_once