James Madison was President during the War of 1812. Proponents for the annexation of Canada believed that the invasion would be a cake walk as Britain was heavily involved in Europe fighting Napoleon. This turned out to be a bad miscalculation. The.war became so unpopular it became known as Mr Madison's War. Things looked bleak when Napoleon was defeated and the British had additional resources to deal with the Americans. The British were just as unsuccessful in their invasion attempts. Although they raided and burned Washington D.C. , they were repelled at Baltimore, Plattsburgh, and New Orleans. The Treaty of Ghent ended the war on December 24, 1814.

More Info: en.wikipedia.org