I have this piece of code that is supposed to insert data in a table and fill a txt file with the same data. However I am finding that the table is being filled with the appropriate 2019 rows but the file only contains 1639 with a [Incomplete last line] message at the bottom. What is causing this?
while(ora_rs.next()){
sql_stmt.executeUpdate("INSERT INTO SCHED_BUNDLES_TEMP_TEST VALUES (" +
ora_rs.getString("BUNDLE")+", " +
ora_rs.getString("DROPPER_ID")+", '" +
ora_rs.getString("SCHED_DT")+"')");
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Date new_date = (Date)formatter.parse(ora_rs.getString("SCHED_DT"));
SimpleDateFormat newFormat = new SimpleDateFormat("MM/dd/yyyy");
String final_string = newFormat.format(new_date);
out.write(ora_rs.getString("BUNDLE")+"|"+ora_rs.getString("DROPPER_ID")+"|"+final_string+"\n");
ii++;
}
My guess is you have a buffered stream and you are not close()ing or flush()ing the stream which means the end of the file is not being written (as its still in memory)