I am using PrintWriter to output the results of my query that has 6,000 records. It properly inserts them into the database but not outputting to a text file. It stops printing the results at about 5000 out of the 6000 rows (records).
... StringBuffer insertBfr = new StringBuffer(); insertBfr.append("INSERT INTO x_table VALUES (").append( so forth....
Is there a limit on how much data I could output using the PrintWriter class?
Hi Gregory, It seems to me that you are printing the whole file in a single println(...) statement, is that right? If this is the case, I suggest you split it so that you print each sql insert statement at a time (you probably have a for loop, so it is not a big change). Two advantages on that approach: memory saving -- no huge StringBuffer walking around -- and it would be easier to find out why the file isn't fully written. That might solve the problem also, but it is just an assumption.
Henrique Sousa<br />SCJP 1.4<br /> <br />All men die, not all men really live - Braveheart, 1995
Joined: Jun 01, 2004
Henrique...Thank you for your fast reply. Yes, it is in a loop. I will try your suggestion and will post the results after my run. Thank you again.