Exporting Stored procedure results to the Excel Sheet using Java

Discussion in 'Java' started by AD1234, Mar 26, 2008.

  1. AD1234

    AD1234 Guest

    Hi,

    I want to export the results generate by stored procedure or query to
    the Excel format using Java.
    Any help would be appreciated.

    Thanks!
     
    AD1234, Mar 26, 2008
    #1
    1. Advertising

  2. AD1234

    Lord Zoltar Guest

    On Mar 26, 2:21 pm, AD1234 <> wrote:
    > Hi,
    >
    > I want to export the results generate by stored procedure or query to
    > the Excel format using Java.
    > Any help would be appreciated.
    >
    > Thanks!


    Do you need special Excel-specific formatting? If not, the easiest way
    to get the data into Excel is probably a CSV file, as Excel can open
    CSV files without a problem.
    If you need basic formatting, you can put your data into a formatted
    HTML table and then save is as a file with an XLS extension - it's a
    bit of a hack, but for simple purposes, it works just fine.
    If you want to get fancy and export macros or something, well then,
    uh... I dunno. ;)
     
    Lord Zoltar, Mar 26, 2008
    #2
    1. Advertising

  3. AD1234

    AD1234 Guest

    On Mar 26, 11:41 am, Lord Zoltar <> wrote:
    > On Mar 26, 2:21 pm, AD1234 <> wrote:
    >
    > > Hi,

    >
    > > I want to export the results generate by stored procedure or query to
    > > the Excel format using Java.
    > > Any help would be appreciated.

    >
    > > Thanks!

    >
    > Do you need special Excel-specific formatting? If not, the easiest way
    > to get the data into Excel is probably a CSV file, as Excel can open
    > CSV files without a problem.
    > If you need basic formatting, you can put your data into a formatted
    > HTML table and then save is as a file with an XLS extension - it's a
    > bit of a hack, but for simple purposes, it works just fine.
    > If you want to get fancy and export macros or something, well then,
    > uh... I dunno. ;)


    Well. Thanks for a quick reply.

    The stored procedure is not really complex. It is like (select top 10
    * from clients).
    The constraint is, it has to be a stored procedure. Not a direct SQL
    statement.
    Also, it should export results in Excel Sheet format. Not really well
    formatting required.

    If you can link up some example or some way it would be a good help.

    Thanks!
     
    AD1234, Mar 26, 2008
    #3
  4. AD1234

    Arne Vajhøj Guest

    AD1234 wrote:
    > The stored procedure is not really complex. It is like (select top 10
    > * from clients).
    > The constraint is, it has to be a stored procedure. Not a direct SQL
    > statement.
    > Also, it should export results in Excel Sheet format. Not really well
    > formatting required.


    I assume you know how to call your SP using CallableStatement.

    To write to Excel you have at least 3 options:

    1) Write a CSV file which Excel reads fine. This is by far
    the easiest.

    2) Use Apache POI to write a XLS file.

    3) Use JDBC ODBC bridge and ODBC driver for Excel to
    write XLS file.

    Arne
     
    Arne Vajhøj, Mar 26, 2008
    #4
  5. AD1234

    Lew Guest

    AD1234 wrote:
    >> The stored procedure is not really complex. It is like (select top 10
    >> * from clients).
    >> The constraint is, it has to be a stored procedure. Not a direct SQL
    >> statement.
    >> Also, it should export results in Excel Sheet format. Not really well
    >> formatting required.


    Arne Vajhøj wrote:
    > I assume you know how to call your SP using CallableStatement.
    >
    > To write to Excel you have at least 3 options:
    >
    > 1) Write a CSV file which Excel reads fine. This is by far
    > the easiest.
    >
    > 2) Use Apache POI to write a XLS file.
    >
    > 3) Use JDBC ODBC bridge and ODBC driver for Excel to
    > write XLS file.


    AD1234, "Excel Sheet" format is many formats - Excel excels at reading many.
    There is perhaps an engineering reason why you think you need to use its
    (current) native format? If so, please share it. If not, just use any format
    that works. Preferably the easiest one to write from Java.

    What does "Not really well formatting required" mean?

    --
    Lew
     
    Lew, Mar 27, 2008
    #5
  6. AD1234

    ram Guest

    On Mar 26, 11:21 pm, AD1234 <> wrote:
    > Hi,
    >
    > I want to export the results generate by stored procedure or query to
    > the Excel format using Java.
    > Any help would be appreciated.
    >
    > Thanks!


    Hi
    Use FOP(XML,XSLT) for that
     
    ram, Mar 28, 2008
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. http://www.visual-basic-data-mining.net/forum

    Exporting Datagrid's data to an Excel Sheet.

    http://www.visual-basic-data-mining.net/forum, Oct 25, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    592
    Steve C. Orr [MVP, MCSD]
    Oct 25, 2004
  2. =?Utf-8?B?U2lsZWVzaA==?=
    Replies:
    4
    Views:
    408
    =?Utf-8?B?U2lsZWVzaA==?=
    Nov 5, 2004
  3. =?Utf-8?B?U2lsZWVzaA==?=
    Replies:
    1
    Views:
    735
    Jim Corey
    Nov 8, 2004
  4. Patrick Olurotimi Ige
    Replies:
    2
    Views:
    512
    Eliyahu Goldin
    May 9, 2005
  5. =?Utf-8?B?U3JpZGhhcg==?=

    change the sheet name while exporting datagrid data to excel

    =?Utf-8?B?U3JpZGhhcg==?=, Nov 9, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    539
    =?Utf-8?B?U3JpZGhhcg==?=
    Nov 9, 2006
Loading...

Share This Page