-
Mar 2nd, 2009, 10:51 PM
#1
Database to flatfile
i have been trying al ot to copy content from database to a flatfile.Iam able to retreive but doesn copy to a file.i have no errors too,plz help.
-
Mar 3rd, 2009, 09:14 AM
#2
You'll probably want to use the FlatFileItemWriter:
http://static.springframework.org/sp...s.html#d0e4650
Without any details, it's hard to provide more guidance than that...
-
Mar 4th, 2009, 12:11 AM
#3
hi there..
thanks for ur reply....
i am reading from a database and writing to a flatfile....i have followed the trade job example given in the samples......but i am not able to write it.i have no errors too..it says successfull...but doesn write to the file.....i donno whr i am going wrong..its reading from db..i can retrieve the values too.....u have any idea if there is anyother way to read from db and write to flatfile...
-
Mar 4th, 2009, 04:43 AM
#4
hi..
my problem is solved...the problem was with the path.Now i have a scenario of reading data from db and writing it to multiple files on the fly.The scenario may be like taking data from the file at the end of day...so data may vary day to day..may be 10, 15..50 ,anythng...so not sure of how many writers to use.What cud be the best solution...can u plz help me?
-
Mar 4th, 2009, 08:18 AM
#5
What determines how many files and which records should go to which files?
-
Mar 4th, 2009, 10:15 PM
#6
hi dan,
its like read data from table and write each record to a diff file....the number of records in the table may differ any time...hope you got the scenario....
Last edited by sbdev; Mar 4th, 2009 at 10:53 PM.
Reason: spelling
-
Mar 5th, 2009, 04:47 AM
#7
hi
let me explain u the scenario in detail...
there is table which has an 'id' coloumn which is unique.
now the data must be read and written to a file on the basis of the id.
that is each row will be written in a new file.My doubt is where does my logic go.in the writer or reader?
thnk u
-
Mar 5th, 2009, 09:20 AM
#8
Your reader will read every record from that table. You should create a custom writer that creates a new file for each item that it receives.
-
Mar 6th, 2009, 07:08 AM
#9
hi...
that is what i was trying to do but i am stuck up with the items.How do i limit them to one row in the item.there is no such property in the mapper to say to read or return a particular line...can u help me with this....
-
Mar 6th, 2009, 09:08 AM
#10
I don't really understand your question. Each item returned from the ItemReader will be passed to the ItemWriter which will create a file and write the item.
By the way, what version of Spring Batch are you using?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules