#1 solution - carry a gun. The only reason I say that is this - whenever I do (I from time to time borrow an 8" .44 from a friend with a sizeable arsenal) I don't see bear-one.
I got stalked out of a hole by a bear late this summer. Hit the creek at high tide but didn't pay attention to the height of the tide and found it 3x as high as the previous tides I'd fished. This also gave all the critters less space to move around til it ebbed. I decided just to wait out the tide and try to hit any cohos I saw rolling when I heard a grunt. I moved back up the trail through some overflow and figured I was far enough off, when I heard the SOB stomp through the overflow after me. I then hightailed it upstream post haste and waited for the tide to go out when I was able to get my spot back. Called my buddy when I got home, set up a date with Maggie, and haven't seen bear one the rest of the season. Same thing in another spot I fish. I can show up unarmed, and the first thing I find are tracks filling back up with water. Show up armed, all I see are day old or older tracks. It's definitely a superstitious and not a reasonable cause and effect, but I feel much better onstream if I'm packing.
Bear spray can be effective. I fished with an AB guide this summer who recounted a tale of watching a surly griz turn inside out when it got a dose. The drawbacks of spray are that you might not get a healthy enough dose on the bear to do the job and that you're very likely to get yourself with it to some degree.
John's got the standard practice down. I would avoid whistling, though, since that can make you sound like food.
Here's a resource you find in just about all the parks up here.