As everyone else has said the only real bear defense is pepper spray or a firearm. However if I had the unfortunate experience to defend myself without either of those, I would rather have something than nothing. When trekking in the woods I have made it a habit to carry either a larger fixed blade knife or a hatchet or both for simple preparedness. I have hiked in Alaska a number of times with nothing more than a Hudson Bay axe. Part of the reason I often choose a belt axe over a long knife when hiking "public trails" is because the axe has the image of a tool and a long knife gives the image of a potential "unfriendly or Rambo type." I do this because I will probably meet more people than bears while hiking. Carrying a sidearm in grizzly country is understood, a long knife is often not, because its seldom effective against bear; so its not viewed as bear protection, and thus can make other hikers uneasy (unless its more a machete type of knife).
Which would I prefer in a bear encounter--well both, but I would rely primarily on the knife. I prefer one of the two I already have--a large 11" bowie or my 11" customized Martindale paratrooper. I want a knife that is long and heavy enough for an effective slasher or stabber. Both of these knives will do that. The bowie is better suited to fighting and stabbing than the Martindale with its hilt, however it makes some people look at you cross-eyed if carrying it publically. The Martindale paratrooper has more of machete look and is perceived more as trail tool. Its also designed as striking/slashing tool. Mine is thinned along the upper edge for better stabbing penetration. It has the weight to slash brush or limbs or cut fire wood so this is probably what I would be carrying in bear country. If the bear plays with you a bit instead of simply running you down, slashing is a better option than trying to close with it and stab it. In slashing a knife will be much faster than an axe with the added benefit of being able to stab from the bottom.
Many of those who survive these encounters do so by feeding the bear an arm to protect their vitals from being bitten. If you are lucky enough to give him your left arm you can maybe stick him with the right arm. Its all just a crap shoot as to how they will attack and whether you will have any opportunity to defend yourself at all. I would rather rely on prudent measures to avoid the confrontation, a lot of good luck, or divine intervention than surviving with a knife. But I'd still rather face one with knife than with just an axe or my bare hands.