The opening of the Great Western Railway throughout from London to Bath in 1841 effectively killed the canal and coaching trades, and as the line passed some to the north it brought no advantage to the town. Newbury had to wait until 1847 to join the railway network, with the opening of the Berks and Hants Railway branch line from Reading to Hungerford via Newbury, and until 1906 to be on a main line, with the opening of the direct Reading to Taunton line. As a result, Newbury became something of a backwater market town, with an economy based largely on agriculture and horse-racing.