Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading a text file  RSS feed

 
leo jacob
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

I want to read a file and capture its content into the database in particular columns. Please suggest me how to read and capture particular data from text file for particular fields in database. Thanks in Advance. My text file is like this and it is having multiple records like this

10/03/11 562.06


PAN NO.
Ravi Khanna 123430678003
A-11, Mekhri Circle
Bangalore
Karnataka ###
Bangalore 130001
ABC :1234567890













Ravi Khanna
123456782345 600000.00 200437.94



 
Robin John
Ranch Hand
Posts: 281
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what's stopping you for reading the file ? did you try anything ? paste your code..

if you are stuck from where to start.... following things might help.. Java IO Package

to be specific...

Scanner or BufferedReader
 
leo jacob
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Robin,

thanks for your reply.

I want to read the txt file word by word so that i can store the content of my file in particular columns of my database table. For example name in name column of table, Some figures in number column of my table.

Please find the program that I am using for file reading and writing as a whole.

Also I am attaching my txt file that needs to be captured in database

------------------------------------------------------------------------------------------------------



=====================================================================

File that needs to be read:




31/03/10 222.07


CANCARD NO.
Parminder kaur 4862930100539003
A-22, Frazer Town
GandhiNagar ###
Gujrat 130001
ABC :12345:12:1111:11111













Parminder kaur
1234567893 690000.00 200007.94



01/01/10 to 01/02/10 01/01/10 01/02/10 120000



01/01/10 1234561 ABC Pvt Ltd. , Bangalore , AS 2234.00
01/02/10 12348 PAYMENT RECEIVED, THANK YOU 1780.00CR




Rupees 123.05 will be debited to your a/c 12345665 with Our
Gandhi Nagar(ABC) branch on 01/01/10



12341.76 345671.06 40.00 1234.77 123



1234 123 0 1234 123.66


Additional Points redemption revised! Min Bonus Points 49.

Additional Points got revised. Points are 333.











31/03/10 123.55


Another Record
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!