This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
If you want to be lazy you can use opencsv (see AccessingFileFormats); CSVWriter has a method writeAll(ResultSet rs, boolean includeColumnNames) that will do all the hard work for you. It's open source so you can even look at the source if you want to know how it works.