This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

save query result

 
Mike Yu
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Does someone know how to programmatically save a query result as text file or excel file?
 
Graham Thorpe
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using files concept u can save the results as text files.
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic