If you are buying a gun to protect yourself from a bear, do not buy too little gun. 454, 44 mag, 45 long colt. That's about all I would trust in the handgun department. Honestly, a 12ga with 00 buckshot, of better yet a high quality slug is ideal. I hesitate to suggest several rifle calibers, but if they are at that distance, that's called hunting.... If a rifle is more your speed, a 300 win mag, .338 win mag, 7mm mag, or the old trusty 30-06 outta get the job done. It's just that these bullets have the potential to travel great distances, so in even a semi urban environment, they can be disastrous.
Good luck and be safe. You will also need to practice quite a bit, because in a defensive situation with a bear, you aren't going to have a lot of time to think it through.
Take it easy and Merry Christmas.
(Welcome to the forum btw. Feel free to come see us at the Jolly Roger anytime. We'd love to have you)