Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 74BED17CF7 for ; Tue, 28 Oct 2014 09:15:34 +0000 (UTC) Received: (qmail 85242 invoked by uid 500); 28 Oct 2014 09:15:34 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 85140 invoked by uid 500); 28 Oct 2014 09:15:34 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 85128 invoked by uid 99); 28 Oct 2014 09:15:34 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Oct 2014 09:15:34 +0000 Date: Tue, 28 Oct 2014 09:15:34 +0000 (UTC) From: "Alan Stewart (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CSV-138) CSVPrinter.printRecords(ResultSet) skips first row with SQLServer MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CSV-138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14186624#comment-14186624 ] Alan Stewart commented on CSV-138: ---------------------------------- Forgot about the jtds driver. I used to be the lead of Spring Roo and recall that it was compatible with both SQLServer and sybase. I'll try tomorrow. > 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)