Results 1 to 5 of 5
- 09-29-2009, 04:20 PM #1
Member
- Join Date
- Sep 2009
- Posts
- 5
- Rep Power
- 0
Input file parsing to insert into DB
Hi,
I have a sample input file as follows:
++++++++++ 2009-09-28 15:10:58 ++++++++++++++
++++++++ DAILY SCORES +++++++++++++++++
2009-09-28 15:10:58|AAAA|0
2009-09-28 15:10:58|BBBBB|0
2009-09-28 15:10:58|ACCCC|0
++++++++ MONTHLY SCORES +++++++++++++++++
2009-09-28 15:10:58|AAAA|30
2009-09-28 15:10:58|BBBBB|50
2009-09-28 15:10:58|ACCCC|60
I should ignore first line and then look for "DAILY SCORES" or "MONTHLY SCORES"string. This determines which MySql table has to be used.
Then read the following lines delimited by pipe and insert them into MySql table
Table schema is as follows:
------------------------------------------------------------
dateandtimestamp | program | score
------------------------------------------------------------
Please suggest the best approach to do this.
Thanks,
Mona.Last edited by IDForums; 09-29-2009 at 04:25 PM.
- 09-29-2009, 04:30 PM #2
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Create a Record class that encapsulates the data.
Then create a DBRecord class that holds a Set<Record> and the scores type (Daily or Monthly).
Then create a DBRecordBuilder class that reads the file and creates a Set<DBRecordBuilder>.
That should get you going.
- 09-29-2009, 04:44 PM #3
Member
- Join Date
- Sep 2009
- Posts
- 5
- Rep Power
- 0
Can you please elaborate it more? Could you please give me a skeleton of the program?
Last edited by IDForums; 09-29-2009 at 05:10 PM.
- 09-29-2009, 07:08 PM #4
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
No and No.
- 09-30-2009, 01:13 PM #5
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Similar Threads
-
HTML FILE parsing.
By makpandian in forum New To JavaReplies: 8Last Post: 11-02-2010, 03:00 PM -
Help! - How to insert a new line to a text file
By matpj in forum New To JavaReplies: 13Last Post: 02-24-2010, 05:28 PM -
retain value of input type file in a jsp file while being dynamically generated
By nidhi c in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 09-27-2009, 02:21 AM -
How to insert large data into database using one insert query
By sandeepsai39 in forum New To JavaReplies: 3Last Post: 02-28-2009, 09:17 AM -
Parsing XML File
By rstar7 in forum XMLReplies: 1Last Post: 10-10-2008, 03:31 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks