Results 1 to 5 of 5
  1. #1
    drimades is offline Member
    Join Date
    Mar 2012
    Posts
    27
    Rep Power
    0

    Default Exporting recordset to xls spreadsheet

    I'm using Netbeans to create db application. I need to export the results of a query (recordset) into an excel file.
    How can I do that?
    Here is how I create the recordset:

    Java Code:
    String host = "jdbc:derby://localhost:1527/TownHall";
            String uName = "test";
            String uPass= "111";
            try{
            Connection con = DriverManager.getConnection( host, uName, uPass );
            Statement stmt = con.createStatement( );
            String SQL = "SELECT * FROM TAXES";
            ResultSet rs = stmt.executeQuery( SQL );

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default Re: Exporting recordset to xls spreadsheet

    Use a 3rd party library such as Apache POI to write to an Excel file.

  3. #3
    drimades is offline Member
    Join Date
    Mar 2012
    Posts
    27
    Rep Power
    0

    Default Re: Exporting recordset to xls spreadsheet

    Thanks! Can you give me an orientation on how to use it?

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,185
    Rep Power
    20

    Default Re: Exporting recordset to xls spreadsheet

    Or just produce a CSV from the results (for which there are also 3rd party libraries).
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default Re: Exporting recordset to xls spreadsheet

    Quote Originally Posted by drimades View Post
    Thanks! Can you give me an orientation on how to use it?
    Not if I risk wasting my time trying to help when a reply to one of your crossposts may have done so already

    Crosspost: Exporting recordset to xls spreadsheet

    Please be forthright when crossposting.

Similar Threads

  1. Updatable Recordset
    By deadlyBuzz in forum JDBC
    Replies: 11
    Last Post: 02-09-2012, 05:35 PM
  2. generate excel spreadsheet
    By BigBear in forum Advanced Java
    Replies: 5
    Last Post: 04-27-2010, 03:44 PM
  3. Strange JSTL recordset result problem (Question)
    By jeremy.wilson in forum JavaServer Pages (JSP) and JSTL
    Replies: 6
    Last Post: 01-07-2010, 07:04 PM
  4. List API's that stores Spreadsheet using java
    By britto_bics in forum AWT / Swing
    Replies: 1
    Last Post: 11-18-2009, 04:10 AM
  5. Spreadsheet in Java
    By emceenugget in forum New To Java
    Replies: 4
    Last Post: 10-03-2008, 08:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •