Den 02/08/10 23.35, Luis Fernandes skrev:
Hi im java programmer ,

I have a text file that have 30,000 rows, and each row have 200 char. I need
to parse and insert this information into a physycal file., and a look for
the best way to do that.
First create the physical file so that you can do a "select * from x" (where x is the file).

Then you write a small Java program which registers the jt400 driver (see the doc) and then create a PreparedStatement based on an insert statement corresponding to the file using ? as placeholders (this is generic JDBC-stuff), and then loop over your input calling the prepared statement once per line surrounded with a try-catch catching SQLExceptions and printing out the details, so you can continue even if one line is bad and analyze that line later.

I wrote a small but powerful tool for our internal use a while back that reads in an Excel sheet and uploads the data to a previously created table specified by the user in the same way as described above. If there is sufficient interest I could ask if we could make it available - it is java web start anyway.

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.