How do I get SQL results to text, columns matching up, with data.

Hi All,
I have written a java application, that connect to a database, make a query, and return a resultset, that is then put into a LinkedList.
The main aim of the application is that it should take snapshots of the database at certain intervals, and store a textfile per tableName, with this data. Therefore, I want to create a range of .txt files, or even a html file. The application does not make use of any GUI functionality, so I am not using JFrames etc.
The main problem I have is how to get the column names and data mapped correctly, underneath it. Any ideas are welcome. Thank you.

I hope you're not asking how you get the column names and data into the file in the same order. That is, obviously, by reading and writing them in the same order, of course. The columnnames from the ResultSetMetaData, and the columns from the ResultSet, of course.
I assume you're talking about how you get them to line up in pretty columns? Look at formatf in String or printf in PrintWriter. (And, probably, DatabaseMetaData to get the "sizes" of the varying columns.)

Similar Messages

  • SQL Server Long Text column to Oracle CLOB via DB Link

    Does anyone know how to load a SQL Server Long Text column into an Oracle CLOB column using DB Link? When I try to Select from SQL Server table into Oracle table, I receive the error "ORA-00997: illegal use of LONG datatype".
    Thanks,
    Susan

    Hi,
      This is a known restriction involving long columns -
    (1) LONG datatype not supported with use of DBLINK when insert or update involves a select statement
    (2) LONG datatype cannot be used in a WHERE clause, in INSERT into ... SELECT ... FROM
    constructs, and in snapshots.
    The workround is to use a PL/SQL procedure or try the SQLPLUS COPY command.
    If you have access to My Oracle Support then review these notes -
    Cannot Move A Long From non Oracle database Ora-00997: Illegal Use Of Long Datatype (Doc ID 1246594.1)
    How To Workaround Error: Ora-00997: Illegal Use Of Long Datatype (Doc ID 361716.1)
    Regards,
    Mike

  • [SQL] how can i get this result....??(accumulation distinct count)

    [SQL] how can i get this result....??(accumulation distinct count)
    Hi everybody,
    pls tell me how can it possible to get result?
    ### sample data
    date visitor
    10-01 A
    10-01 A
    10-01 B
    10-01 B
    10-01 C
    10-01 C
    10-02 A
    10-02 C
    10-02 C
    10-02 D
    10-02 D
    10-03 B
    10-03 B
    10-03 B
    10-03 A
    10-03 A
    10-03 F
    10-04 A
    10-04 A
    10-04 F
    result that i want...like this.
    date date_unqiue_visitors acc_date_unique_visitors
    10-01 3 3
    10-02 3 4
    10-03 3 5
    10-04 2 5
    date distinct visitors : count(distinct visitor)
    but how can i get accumulation distinct visitor count???
    Thanks to every body..

    SQL> select dt,cnt,sum(cnt1) over(order by dt) cnt1
      2  from(
      3  select dt,count(distinct visitor) cnt,sum(flg) cnt1
      4  from
      5   (select dt,visitor,(select decode(count(*),0,1,0)
      6                           from test
      7                           where rowid < t.rowid
      8                           and visitor = t.visitor) flg
      9   from test t)
    10  group by dt);
    DT                CNT       CNT1
    10-01               3          3
    10-02               3          4
    10-03               3          5
    10-04               2          5
    Message was edited by:
            jeneesh
    Wrong...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • I upgraded pages.  Now when I begin a new document I automatically have a text box.  How do I get rid of the text box so that it does not automatically appear.  What settings do I need to change?

    I upgraded pages.  Now when I begin a new document I automatically have a text box.  How do I get rid of the text box so that it does not automatically appear.  What settings do I need to change?

    Perhaps you are loading a template that has a text block already on it.
    You might try the blank template option and set that as your go to template in your preferences

  • When I convert a file from PDF to word it is all in characters how do I get it in english text

    Please could someone help me with a converted file. I have bought the adobe acrobat and tried to convert my PDF to word and it just comes up with characters how to I get it in normal text?

    Hello,
    because you wrote in the Reader forum, so I think we talk about it, or? In my case I can change the text there (screenshot of my German AR):
    I hope the image is selfexplanatory and I understood you in the reight way. If not please come back to set right.
    Hans-Günter

  • I just loaded the 'lion' now my mail takes a new life....how do i move the reading panel to the bottom / also how do i get rid of the text/content under each mail..two simple things not sure obvious on this version !!!

    i just loaded the 'lion' now my mail takes a new life....how do i move the reading panel to the bottom / also how do i get rid of the text/content under each mail..two simple things not sure obvious on this version !!!

             

  • I have downlades a text tone from itunes how do i get it as my text tone on my iphone 4 ???

    i have downlades a text tone from itunes how do i get it as my text tone on my iphone 4 ???
    PLZ HELP ME !!

    You can't. I don't know what it is you believe you downloaded, but the iPhone does NOT support custom SMS tones at this time. iOS 5 will, but iOS 4 does not.

  • How can i get my iMessage on my mac to sync with the texts i get on my iPhone?

    how can i get my iMessage on my mac to sync with the texts i get on my iPhone?

    Welcome to the Apple Community.
    Are you aware it only syncs iMessages. Also once enabled only new messages will sync, try messaging the user from the Mac and see if that gets things going for you.

  • HT4427 how do you get the speak to text on the iphone4

    How do you get the speak to text on the iphone4??

    You do not... that is a feature of the 4S and 5 with Siri.

  • How can I get required result

    How can I get bellow result...
    For row 1 in Table X: There should be one row in result table.
    For row 2 in Table X: These should be 2 rows one for each package code
    For rows 3 and 4: The X table should be joined with Table Y and create the # of rows depending on the # of Section codes that are in the range of B01M-U01M and B04F-U04F. These are just some sample rows, they code be several rows with the above scenarios in those tables.
    Table X
    Grp_#
    Grp_Name
    Package num
    Product #
    111
    aaa
    123
    PPO
    222
    bbb
    002, 007
    EPO
    333
    ccc
    108-B01M-U01M
    CMM
    444
    ddd
    008, 128-B04F-U04F
    PPO
    Table Y
    ID
    Grp_#
    Pkg_cd
    Section_num
    1
    333
    108
    B01M
    2
    333
    108
    E01M
    3
    333
    108
    U01M
    4
    444
    008
    B04F
    5
    444
    008
    D04F
    6
    444
    008
    M04F
    7
    444
    008
    U04F
    8
    444
    128
    B04F
    9
    444
    128
    C04F
    10
    444
    128
    U04F
    11
    111
    123
    B01E
    12
    222
    002
    B01G
    13
    222
    007
    M04G
    Result Table
    Grp_#
    Grp_Name
    Package num
    111
    aaa
    123
    222
    bbb
    002
    222
    bbb
    007
    333
    ccc
    108-B01M
    333
    ccc
    108-E01M
    333
    ccc
    108-U01M
    444
    ddd
    008-B04F
    444
    ddd
    008-D04F
    444
    ddd
    008-M04F
    444
    ddd
    128-B04F
    444
    ddd
    128-C04F
    444
    ddd
    128-C04F
    444
    ddd
    128-U04F
    Thanks in advance.
    Thanks
    Pathan

    I am very sorry, please ignore this mail..... I have pasted more thread. I am unable to paste table format over here.
    Thanks
    Pathan

  • Please Give me reply for this problem(How can I get the result)???

    Hello Friends,
    I have one table CXATCMS.Which has 3 columns and has the following data
    start_no end_no activity_date
    05001000001 05001000002 01-OCT-03
    05001000015 05001000016 01-OCT-03
    05001000017 05001000018 12-JUN-05
    05001000019 05001000020 12-JUL-06
    I have to create a report which lists the the specific range.
    If the next record's start_no is the immediate next number for the prevoius record's
    end_no .....then it has to display all those numbers in a range until it finds a number which is not next immediate number for the previous record's end number.
    like for example....if the user wants to see from 1 to 20 range.
    then the result must be like this........
    start_no end_no
    05001000001 05001000002-------there is no 05001000003 number in the
    05001000015 05001000020 start numbers so it has to stop its range by this number).
    How can i get this result........

    Hi,
    Try this. I am sure you know how to write procedure, I have skipped those obligations, anyway u can sense the absic way of working from here I think. Pls do the uppercase / lowercase adjustment as required by your operating system.
    Declare
    mnd CXATCMS.end_no%type;
    numRec CXATCMS.%rowtype;
    Cursor C is select * from CXATCMS where start_no between 1 and 20 order by start_no;
    begin
    select min(end_no)+1 into mnd from CXATCMS where start_no between 1 and 20;
    open C;
    Loop
    fetch C into numRec;
    DBMS_OUTPUT.putline(numRec);
    exit when mnd<>numrec.start_no;
    if mnd=numrec.start_no then
    mnd:=numRec.end_no + 1;
    end if;
    end loop;
    Exception
    when no_data_found raise application_error;
    end;
    gimme feadback pl,
    Pragati.

  • TS3198 i just unlocked my i phone 4s. how can i get that result?

    i just unlocked my i phone 4s. how can i get that result?

    1# Make sure you have an internet connection in iTunes.
    2# An AT&T Real MicroSIM(not one that has been cut down) must be in the phone.
    3# Restore in iTunes.
    Hope this helps!!

  • How do you get times on incoming texts?

    how do you get times on incoming texts?

    To use Videora iPod Convertor to convert movies for use on your iPod, consult these helpful links:
    To get started: http://www.videora.com/en-us/Converter/iPod/
    If you have questions: http://www.videora.com/en-us/Converter/guides.html
    If you have more questions, post them here: http://www.pspvideo9.com/forums/index.php?c=8
    Note that Videora iPod Convertor is a 3rd party program. If you need help with it, post your question there.
    GFF

  • How do I get my new 27" Thunderbolt Display to work with my mid-2010 Macbook Pro?

    How do I get my new 27" Thunderbolt Display to work with my mid-2010 Macbook Pro? Or am I SOL?
    Hardware Overview:
      Model Name:    MacBook Pro
      Model Identifier:    MacBookPro6,1
      Processor Name:    Intel Core i7
      Processor Speed:    2.8 GHz
      Number of Processors:    1
      Total Number of Cores:    2
      L2 Cache (per Core):    256 KB
      L3 Cache:    4 MB
      Memory:    8 GB
      Processor Interconnect Speed:    4.8 GT/s
      Boot ROM Version:    MBP61.0057.B0F
      SMC Version (system):    1.57f18

    You can't. Theoretically, Thunderbolt devices that only transfer video and audio should work with Mini DisplayPort MacBooks like yours, but it's not the case of the Thunderbolt Display. Its firmware doesn't allow it to be used with non-Thunderbolt Macs, so you can't use the Thunderbolt Display with the Mid 2010 MacBook Pro.
    Instead, you have to look for another screen, or you can get an adapter and connect the MacBook Pro to a TV

  • I am having difficulty: we are running a windows server 2003 - mail and outlook support 2007 and upwards, how do I get the brand new apple machines to work with the 2003 version of server

    I am having difficulty: we are running a windows server 2003 - mail and outlook support 2007 and upwards, how do I get the brand new apple machines to work with the 2003 version of server

    I may be way out, but do you know about this product, would it help integrate the Macs for you.
    https://www.thursby.com/sites/default/files/images/ADmitMacv8_SPD.pdf

Maybe you are looking for

  • For All The ATI Radeon9600 Pro users only.

    If you are an owner of a built by ATI Radeon 9600pro card then you should take some interest in this post.   Some of you may know of the modifications you can do to the Radeon 9500 non-pro and turning it into a 9700 Pro.  By installing the bios of a

  • Posting Mode: actual or statistical posting. Admission fee must be actual

    Hi Experts Can You help me with Admission fee. I found in  IHE 203 that The Admission fee must be actual posting, but my clinet want to have it as a statistical posting. I want to run fee calculation In Calculation Base: Admission Application Data an

  • Flex Builder 3.0 Licence purchase request

    We have installed flex builder 3.0 (trail version) as part of the FLEX development and design mode working fine. The problem is not able to buy  license for this specific version 3.0. When clicks on Purchase button under Manage Flex Builder License t

  • 10.6.8 and Creative Cloud

    I have tried at least 10 times to download InDesign CS6 without any success. At the very end of the download it gives me an installation error, and I've retried WAY too many times. Any help? Running on 10.6.8 because I don't want to lose Quark 6.5 at

  • BEST Way to Revert back to ipod Version 1.0

    u can do it without restoring. 1. Open "My Computer" 2. Double-click your iPod drive 3. Make sure your computer is set to view hidden files (if it is not, go to Tools > Folder Options and click on the view tab. Select "Show hidden files and folders,