aspose 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 OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "reading from a .data file" Watch "reading from a .data file" New topic

reading from a .data file

Isaac Ferguson
Ranch Hand

Joined: Jun 22, 2012
Posts: 424

I have read the files ( and 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?

fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11574

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: 424

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?


K. Tsang

Joined: Sep 13, 2007
Posts: 2673

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?

Charles Karlnesky

Joined: Aug 13, 2013
Posts: 4
Hello there,
I am curious how can you read 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,
I agree. Here's the link:
subject: reading from a .data file