You can book with DB Bahn............
http://www.bahn.de/international/view/en/index.shtml
on their website up to 3 months prior to departure. They have some really inexpensive fares,they usually go fast. I got mine for 19euros. You can choose from 1st or 2nd class, 2nd class is fine unless the 1st class is just a few Euros more. You can set up an account even if you won't be using it much, and print your ticket right on-line. Also if you are travelling to Germany from another country it works also, but then a paper ticket will be mailed to you. I have booked many tickets this way.