Question: how to export data from database to excel sheet in java?
Answer: Get the reference of Database. Class.forName("com.mysql.jdbc.Driver"); ... 
Get the reference of Ms Excel File. static String url = "jdbc:odbc:DRIVER={Microsoft Excel Driver (*.xls)};" + ... 
Get the data from a table as ArrayList. ArrayList getDataFromDB(){} ... 
Get data from ArrayList and insert into Excel Sheet.