I'm using JDBC to return a large result set (>1,000,000 records...). I want to write it out to a simple text file. Getting the records from a remote server very fast. But writing them out locally to a simple text file is very slow.
Is there a way in java to write text files FAST? Like, can you somehow read the next 1000 results, store them in memory, and then write them out at once?
This is the code:
Connection con = DriverManager.getConnection("jdbc:as400://" + host, user, pwd);
java.sql.Statement stmt = con.createStatement();
String sql="SELECT * FROM MYLIB.BIGFILE";
ResultSet rs = stmt.executeQuery(sql);
// System.out IS the text file. The row is all one string.
Thanks, Experts !