Sounds like you need a new battery.
Was your battery attached to the laptop? It sounds like you overcharged your battery if you used it for 2+ years with your laptop plugged in.
This happened to me with my ThinkPad T40. I used it for about 6 - 9 months plugged into the A/C outlet with the battery installed. Afterward, the battery only lasted 10 - 15 minutes. After numerous fully charging / discharging over several months the battery was able to hold a 2.0 - 2.5 hour charge; that's roughly a 40% - 50% capacity before I overcharged the battery.
My advice is to disconnect the battery if you are going to be using it plugged in for a long period of time. If you are the type that may travel on a moment's notice, then I would fully charge the battery and then disconnect from the laptop. Once a week connect the battery to the laptop and recharge it for a short period of time. 15 - 30 minutes should be more than enough, then disconnect the battery again.