This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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: 42958
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: 3740

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!