File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes reading from a .data file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "reading from a .data file" Watch "reading from a .data file" New topic
Author

reading from a .data file

Isaac Ferguson
Ranch Hand

Joined: Jun 22, 2012
Posts: 321
Hi,

I have read the files (Person.data and Order.data) and populate the tables (PERSON and ORDER).

In the files I have data like "1, Angus, Scott, Rozel, Bristol " in the PERSON file. And 1|2 in the ORDER file

Then I need populate tables in a DB using JDBC.

Any idea, please?

Thanks
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 10908
    
  12

That is a fairly broad question. Those are usually met with broad answers. such as

1) read the first file
2) parse the data
3) insert into database
4) read second file
5) parse the data
6) insert into database.

Do you have SPECIFIC questions you need help with? There are so many ways to interpret what you wrote that it is really impossible to give you any meaningful help.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Isaac Ferguson
Ranch Hand

Joined: Jun 22, 2012
Posts: 321
Hi,

I have parsed the data I can show it in my console from the file.

Teh data is like this

1, Angus, Scott, Rozel, Bristol

I need dinamically every value in a different field in my table.

In my case I have

PERSON [ PERSON_ID (Primary Column), LAST_NAME, FIRST_NAME, STREET, CITY ]in the database.

Then I need set in ERSON_ID (Primary Column) -->1 ,etc

Any idea?

Thanks

K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 1958
    
    7

Well you said you can read the file in code. The next step would be to parse it into the proper fields. Are all lines comma-separated? How would you split it up?


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD
Charles Karlnesky
Greenhorn

Joined: Aug 13, 2013
Posts: 4
Hello there,
I am curious how can you read Person.data file? I mean by .data at the end you mean it could be .txt file? My question is, what is a file with a .data extension?
Best wishes,
Tage
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: reading from a .data file
 
Similar Threads
Descending order and associating Array Elements in sort method to another's elements
NX: flexibility of database definition
use diffrent servlet values (how to unload a servlet)
CSV file structure Validation
Hadoop and compression