Added database and table existing check.