I'm not an avid hunter, but from the little bit of research that I have done it would seem to me that if you shot a large bear with a .40, you'll most likely just piss it off and then become bear food in a real hurry. Buckshot would most likely not help you very much either in the event of a large violent bear encounter.
If you insist on carrying a Glock into the woods then I would probably go with the Glock 20 (10mm) with plenty of extra magazines. The 10mm is the 'absolute minimum' that I would personally want to carry into that sort of situation and I'm not even sure that the 10mm would have enough stopping power for a large pissed off bear to be quite honest.
A 12 gauge loaded with plenty of slugs would be even better imvho.
For an 'up close & personal' situation with the bear allready on top of you, pray that you can even get to your sidearm in time and fire some well placed shots...I would say that even with a much larger caliber sidearm like the .500 S&W Magnum or the .460 S&W Magnum, you would be really screwed before the bear even expired from blood loss.
Just my .02 cents.
"In the meanwhile Glen became separated from me as a small body of water prevented him from coming my way and closer to the boar that was on the kill. The bear started to get up when Glen backtracked and got along side of me. I trained my revolver at the bear and watched Glen as he lay on the ground in a firing position. I nodded my head to him and a second later, the blast of his .500 Smith & Wesson echoed against the distant hillsides. The bear never flinched when the bullet hit him and it continued to get up. Immediately I fired my .500, the bullet striking the great bear center mass and again, it never flinched. We were about 20 yards from it and in a spot where we could be readily seen by the beast. In a blur, we continued firing when our backup with his 45/70 fired twice into the bear on the 7th or 8th shots. When the first 45/70 bullet hit it the bear went down and it got back up, the second hit didn’t seem to faze it. Glen and I advanced and kept firing at the bear. We stopped 15 yards from the wounded brownie and then I heard one of the most terrible sounds I have ever heard in my life come from Glen’s gun. Click. He had run out of ammunition. Immediately I leveled off at the animal and squeezed the trigger, the Smith & Wesson exhaled it’s firebreath . The bear went down and stayed".
"Labored breathing is all that could be heard for that moment, the great bear lay dead. Collecting our wits, we stayed back from the beast just in case it came back alive. It’s a very good idea not to go charging in after a kill, especially with bears. I like to give a minimum of half an hour after the bear goes down before going up to it. Simply said, it’s too dangerous. Glen Sr. said the moment we started firing he shouldered his scoped .338 just in case the bear attacked us. In the end, the bear had been shot 12 times. Two bullets found their mark from the 47/70 rifle and there were 10 slugs from the pair of Smith & Wesson .500’s, all shot at close range. As we spoke, Glen Sr., a registered Master Alaskan guide said he had seen bears die with one shot and others like this big boy that took a barrage of shots before going down. Funny thing".
Link Removed