Those damn commie bears are the worst.
I grew up in the mountains, lived there for 15 years and had many encounters with bears, big and small - never one in which I had to defend myself. People have a strange view of wildlife when they have no experience. We used to scare them off with rocks all the time if they were in our garbage (no guns allowed in the National Parks) before the advent of the "bear proof" garbage cans.
Most times if you encounter a bear in the bush and you're close enough that it's threatened enough to charge; you've already done so many things wrong a gun isn't gonna save you. Avoiding confrontations with large predators is the proper way to be, be aware of your surroundings, know the sign and keep your eyes and ears open.
In the event that you do have an encounter with a bear that is a threat, as it does happen to even the most experienced people, the accepted weapon is the 12ga with slugs, of course.
9mm is for stopping people, not 1000lb bears. If it was all I had, I'd want the heaviest load I could get, empty the mag and then reach for a spear. Spears have been killing bears for a thousand years.