Ever wonder by you can keep a jar of unopened tomato sauce in the cabinet for months without any problems, but after you open it and put it in the refrigerator, it spoils in a couple of weeks? What makes canning last longer than refrigeration?
All forms of food preservation have the same basic goal, being to combat bacterial growth.
In the case of refrigeration, the cold temperatures slow down the activity of the bacteria. The bacteria are still alive and active, but it takes longer than normal for the bacteria to destroy the food.
However, some forms of food preservation, like canning, work by destroying the bacteria already present in the food, in effect, sterilizing it. Once the food is sterilized it's sealed so that no new bacteria can invade it. The process of canning works by boiling the food in the can and sealing it either before or while the food is boiling. As the can is sealed before the food stops boiling, the food becomes bacteria-free. It will remain so until the can is opened and bacteria are given free reign to invade again.
Canning is the name given to the general process of sterilizing food and sealing it. Canning can be done with a jar, in plastic, or even a box. If you've ever bought boxed milk, then you know what I'm talking about.