Csvtosql is a library and tool to convert any CSV-based data. It accepts multiple data formats (such as CSV, Excel, or arrays), converts it into SQL statements, and writes the data back in multiple formats (textfile, database).
| Tags | Database |
|---|---|
| Licenses | GPL |
| Operating Systems | OS Independent |
| Implementation | Java |
Recent releases


Release Notes: The license was changed from GPL to LGPL.


Release Notes: Support for generics was added. WriterList was removed, as it was replaced with a simple List with generics. The descriptor version was changed to 3. All examples were updated.


Release Notes: This release adds presql and postsql options to SqlInsertRendererFromExcel and optional acceptwrongrows parameters in SqlInsertRendererFromExcel and SqlInsertRendererFromArray.


Release Notes: This release adds the new example test.excel.skip and "skipfields" support to SqlInsertRenderFromExcel.


Release Notes: startrow/stoprow support was added to the SqlInsertRendererFromExcel renderer.
Recent comments
16 Aug 2004 01:26
Re: It fails the Java CookBook test
via csvtosql.sourceforge.n... you can try
the java web start version of csvtosql (version 1.8) that solve this problem, i will do file release in a few days.
thanks for comments :).
the bug can be inserted at
sourceforge.net/tracke...
16 Aug 2004 00:16
Re: It fails the Java CookBook test
Don't misunderstand me pls. I really like your program ! The way you designed renderers, grammars, writers is really cool.
CSV is just sooo difficult.
15 Aug 2004 22:58
Re: It fails the Java CookBook test
> what is wrong line ?
sorry the wrong line was the 5th :) :)
with new version of cvstosql (1.8) will work.
the next version will be released in a few days.
this is the new test with cvs version
mysql> INSERT INTO prova (uno, due) VALUES ('Hello', 'World');
Query OK, 1 row affected (0.00 sec)
mysql> INSERT INTO prova (uno, due) VALUES ('123', '456');
Query OK, 1 row affected (0.00 sec)
mysql> INSERT INTO prova (uno, due) VALUES ('LU', '\"86.25|\"\"11/4/1998\"\"|\"\"2:19PM\"\"|+4.0625\"');
Query OK, 1 row affected (0.01 sec)
mysql> INSERT INTO prova (uno, due) VALUES ('\"bad \"\"input\"\"\"', '1.23E+03');
Query OK, 1 row affected (0.00 sec)
mysql> INSERT INTO prova (uno, due) VALUES ('XYZZY', '\"|\"\"OReilly & Associates| Inc.\"\"|\"\"Darwin| Ian\"\"|\ "\"a \\"\"glug\\"\" bit|\"\"|5|\"\"Memory fault| core NOT dumped\"\"\"');
Query OK, 1 row affected (0.00 sec)
15 Aug 2004 22:43
Re: It fails the Java CookBook test
> 4 out of 5 ;-)
why 4 of 5 ?
what is wrong line ?
Davide
14 Aug 2004 22:38
It fails the Java CookBook test
The famous testcase as published in the well know Java CookBook:
Hello;World
123;456
LU;"86.25|""11/4/1998""|""2:19PM""|+4.0625"
"bad ""input""";1.23E+03
XYZZY;"|""OReilly & Associates| Inc.""|""Darwin| Ian""|""a \""glug\"" bit|""|5|""Memory fault| core NOT dumped"""
Transforming this CSV using csvtosql yields the following in MySQL:
INSERT INTO TEST (A, B) VALUES ("Hello", "World");
INSERT INTO TEST (A, B) VALUES ("123", "456");
INSERT INTO TEST (A, B) VALUES ("LU", "\"86.25|\"\"11/4/1998\"\"|\"\"2:19PM\"\"|+4.0625\"");
INSERT INTO TEST (A, B) VALUES ("\"bad \"\"input\"\"\"", "1.23E+03");
INSERT INTO TEST (A, B) VALUES ("XYZZY", "\"|\"\"OReilly & Associates| Inc.\"\"|\"\"Darwin| Ian\"\"|\"\"a \\"\"glug\\"\" bit|\"\"|5|\"\"Memory fault| core NOT dumped\"\"\"");
4 out of 5 ;-)