File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes CSV file to database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "CSV file to database" Watch "CSV file to database" New topic

CSV file to database

Patrick Mugabe
Ranch Hand

Joined: Jan 08, 2002
Posts: 132
I want to update a csv file to my database. Can you help with ideas. I am not sure how it's done.
[ August 30, 2006: Message edited by: Patrick Mugabe ]
Patrick Mugabe
Ranch Hand

Joined: Jan 08, 2002
Posts: 132
For those who might face the same problem, there's an open source csvJdbc driver that can be used. It reads from the cvs then you can use your ordinary JDBC java code to insert into your database table
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Is the problem the reading or writing of CSV files, or the DB access? If the former, have a look at a library that can work with CSV files, like the Ostermiller Utils.
[ August 30, 2006: Message edited by: Ulf Dittmer ]
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3753

CSV files are pretty easy to read, you might want to consider just writing a simple JDBC based script that performs the update manually.

[OCA 8 Book] [Blog]
I agree. Here's the link:
subject: CSV file to database
It's not a secret anymore!