Hi, i'm new to java and am trying to build a database program about boats which needs to output a .csv file. I have it all working except for one issue. It runs fine as shown below and, as expected, only outputs the first record. When i 'uncomment' the for statement it gives the error 'no data found' at line 205 (the first line that tries to access the database) during the second iteration. I know the database has data because it works without the for statement. I originally tried to do this with a do/while statement but that gave an invalid string or buffer length error which is unsolvable (see http://www.coderanch.com/t/491407/JDBC/java/Mircrosoft-Driver-Manager-Invalid-String). (I am running it on a windows 7 64 bit system).
The database has more than one record and should return null if there is no data in the field. The numrows value is correct and is found by moving the pointer to last then getRow() then moving it back using first().
You should not be calling the a flush method inside of a loop. You should never call flush until you are done adding to a writer. Secondly you should be using the next() method to iterate over a ResultSet.
posted 5 years ago
Runs fine now, thanks for your help. (still not sure what was wrong with my first do/while loop though )
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads