This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
This should do what you want: Assume the resultset has 5 columns:
NOTE: files with the extension *.csv default to open in Microsoft Excel, unless manually change by the user's settings. *.csv files represent comma delimited files in which each column value is separated by a comma. Each row is separated by a newline character which is automatically added when using the println method of PrintWriter. Jamie