IntelliJ Java IDE
The moose likes I/O and Streams and the fly likes Generating flat file from Database Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Reply Bookmark "Generating flat file from Database" Watch "Generating flat file from Database" New topic
Author

Generating flat file from Database

J Dan
Greenhorn

Joined: Mar 18, 2002
Posts: 1
Ok... I'm trying to pull information from a database, concatenate (sp?) it and throw it into a flat (text) file as one line per record. Currently, to check my program I use a system.out.println() to make sure I'm pulling and putting together the proper stuff. Yep, that works, goes through the entire database table and it's fine. However, whenever I go to check my text file I created, it only has 1 record, the last one. I'm just about going to lose it... I've tried printwriters, bufferedwriters, and about 5 other things. It just keeps overwriting (I suppose) the previous line with each new line (yep, used line seperators and newline both to no avail) instead of placing a carriage return or other seperation device. Any help would be appreciated.
Colin Humber
Greenhorn

Joined: Nov 05, 2001
Posts: 6
Don't know if you've already tried this, it may help.
FileWriter(String fileName, boolean append)
Constructs a FileWriter object given a file name with a boolean indicating whether or not to append the data written.


Sun Certified Programmer for the Java 2 Platform.<br />Sun Certified Programmer for the Java 2 Platform, 1.4.<br />Sun Certified Web Component Developer<br />IBM Certified Specialist VisualAge for Java.<br />IBM Certified Solution Developer (OOAD w/ UML).
 
IntelliJ Java IDE
 
subject: Generating flat file from Database
 
Threads others viewed
To Michael Earnest....
record cache
Insert and retrieve new line character in DB2
Lock Manager implementation
Bodgitt & Scarper - Database Record Numbering
IntelliJ Java IDE