In the old days, sales representatives from drug companies would chat up local pharmacists to learn what drugs doctors were prescribing. Now such shoulder-rubbing is becoming a quaint memory — thanks to vast databases of patient and doctor information being used by pharmaceutical companies to market drugs. The information allows drug makers to know which drugs a doctor is prescribing and how that compares to a colleague across town. They know whether patients are filling their prescriptions — and refilling them on time. They know details of patients' medical conditions and lab tests, and sometimes even their age, income and ethnic backgrounds.