Indeed, it's best to always try a gun before you buy it if possible. Then you can get an idea of how it handles, felt recoil etc. But that's not always possible. If you do know of a range that rents guns, do some research online first. Familiarize yourself with the guns that fit your needs, then go rent as many as you can. Most ranges will let you rent a gun for X Amount, then bring it back and switch it for another for a few extra bucks.
If you want something small, easy to conceal, and 9mm, the M&P Shield is top of the list of suggestions that I'd make. They can also be had in 40 Cal if it interests you. There's also the Springfield XD series. The XDs models are available in both 9mm and .45, and the .45 isn't that bad to shoot at all if you want a bigger round. Glock has the new ultra compact 9mm released earlier this year, forget it's model number though. Haven't fired one, but have heard good things about them since the initial bugs were worked out. If you're familiar and proficient with 1911 style guns, the Sig Sauer 939 is an excellent gun, though rather expensive compared to the others. Beretta Nano gets an honorable mention. It's a chunky little 9mm, but very easy to shoot. Owned one of the initial runs, and it was picky about the ammo it would cycle so I sold it. That was almost 4 years ago, so that should be remedied by now.
Don't rule out a good revolver. If you're worried about someone up close and personal, I'd pick a small revolver over a semi auto any day of the week. Good 38 Sp +P hollow points up close are every bit as effective as 9mm. A revolver rarely malfunctions, if ever, especially a quality one. If a round fails to fire, there's no racking the slide to clear a dead round in the heat of the moment under stress. Just keep pulling the trigger. S&W or Ruger would be tops in the revolver department. The S&W Airweights can be carried in a pants pocket and you won't know it's there. A short barrel Model 60 would be a bit heavier, but allow the option of carrying .357 if you really wanted to make a lasting impression on a bad guy. A Ruger LCR can be had in .38 and .357. They're all good light weight options as well.
The revolver I'd suggest is the Ruger SP101. You can get the 2.25in barrel in .357 with a hammer, or hammerless double action only. It's the heaviest of the "snubnose" revolvers out there. But they're built like a tank, and with a good holster, it's well worth carrying. I carry one daily in a Simply Rugged Silver Dollar holster with no issues at all. And if 5 rounds of .38 +P or .357 isn't enough to stop a bad guy, at 25oz, I can always beat him senseless with the empty gun!