I want to export my MySQL database to .xls or .txt format. How can I do it in java. What I want to do is that there is a button in my application on pressing which, my database export to excel file. Thanks.
You can use BIRT and generate your database to any format you want. If you are using struts2 you can use datagrid
to export it to CSV or Excel.
You may find that it is helpful:
SELECT ....... INTO OUTFILE '/tmp/result.text' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM table