[
https://issues.apache.org/jira/browse/CSV-138?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gary Gregory closed CSV-138.
----------------------------
Resolution: Not a Problem
The driver used has a bug.
> CSVPrinter.printRecords(ResultSet) skips first row with SQLServer
> -----------------------------------------------------------------
>
> Key: CSV-138
> URL: https://issues.apache.org/jira/browse/CSV-138
> Project: Commons CSV
> Issue Type: Bug
> Components: Printer
> Affects Versions: 1.0
> Reporter: Alan Stewart
>
> WIth SQLServer's 2012 jdbc driver 4.0, when I call CSVPrinter#printRecords
> with a java.sql.ResultSet, the first row is not printed. It appears that the
> line
> {code}
> final int columnCount = resultSet.getMetaData().getColumnCount();
> {code}
> positions the cursor on the first row and then when
> {code}
> while (resultSet.next()) { ...
> {code}
> is called, the 2nd row onwards is what is getting outputted.
> As a workaround, I used :
> {code}
> final int columnCount = rs.getMetaData().getColumnCount();
> do {
> for (int i = 1; i <= columnCount; i++) {
> csvPrinter.print(rs.getString(i));
> }
> csvPrinter.println();
> } while (rs.next());
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)