Return-Path: Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 61461 invoked from network); 30 Jan 2003 15:11:19 -0000 Received: from isp247n.hispeed.ch (HELO smtp.hispeed.ch) (62.2.95.247) by daedalus.apache.org with SMTP; 30 Jan 2003 15:11:19 -0000 Received: from alhambra (dclient217-162-108-160.hispeed.ch [217.162.108.160]) by smtp.hispeed.ch (8.12.6/8.12.6/tornado-1.0) with SMTP id h0UFBJfm030219 for ; Thu, 30 Jan 2003 16:11:19 +0100 From: "Bernhard Wagner" To: "Jakarta Commons Users List" Subject: RE: [jelly] csv file to database Date: Thu, 30 Jan 2003 16:12:19 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 In-Reply-To: <042901c2c86b$e43fd680$9865fea9@spiritsoft.com> X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N > -----Original Message----- > From: James Strachan [mailto:james_strachan@yahoo.co.uk] > Sent: Donnerstag, 30. Januar 2003 15:27 > To: Jakarta Commons Users List > Subject: Re: [jelly] csv file to database > > > From: "Gordon" > > Would Jelly be a good tool to import a CSV file into a database? If so > > what tag would I use to parse the CSV file? > > It might be nice to write a new tag or bean to parse a CSV and > iterate over > its rows providing a List for each row. Then you could do things like > > e.g. > > > > insert into foo (a, b, c) values (?, ?, ?) > > > > > > > James Additionally, I would add an attribute to the csv tag called recordSeparator. There are some conventions as to how csv fields are encoded (particularly in M$ environments), e.g. how to escape commas within fields when comma is the field separator (typically by quoting the field with double quotes ("); double quotes themselves within quoted fields are quoted as double double quotes (""), etc. etc.). One trap that should be avoided: newlines within fields should not be misinterpreted as record separators... I am currently unaware of a Java library that would support these requirements but am willing to contribute outlining/implementing something like this. Bernhard