Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-17-2008, 09:31 AM   #1
LQ Newbie
Registered: Apr 2008
Posts: 1

Rep: Reputation: 0
Reading a CSV text file and storing the values in Oracle Database table


I want a C programme to read a CSV text file and store the values in table(Oracle database).. when i execute this c-executable the values would read from CSV and transferred to a table present in Oracle..How could i do that?

Old 04-17-2008, 10:14 AM   #2
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Haven't used it but it looks like this might be what you want or at least give you ideas about how to do it since the source for what he is doing is available:
Old 04-17-2008, 10:21 AM   #3
LQ Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,841

Rep: Reputation: 8008Reputation: 8008Reputation: 8008Reputation: 8008Reputation: 8008Reputation: 8008Reputation: 8008Reputation: 8008Reputation: 8008Reputation: 8008Reputation: 8008
If you want to break it down into steps:

- Check for the .CSV file you're wanting to open
- If its present, open it
- Connect to your database
- Read each line of the file, splitting the different fields at the commas
- Insert the record(s) into the database, until you hit EOF
- Close the database connection
- Exit

I've done things like this in Perl, using MySQL as the back end, and can usually do it in just a few lines of code. Haven't played with C in quite a while, though.
Old 04-17-2008, 12:19 PM   #4
Registered: Jan 2007
Location: INDIA
Distribution: Ubuntu, Debian
Posts: 340

Rep: Reputation: 30
In MySQL the LOAD DATA statement can be used to import text from a csv file to a table

ORACLE has also such a command to load data

I think create C program for this purpose is not required


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to store text(strings) in a 2D character array reading from a text file(C++) bewidankit Programming 3 02-14-2008 07:08 AM
looking for a perl script to convert html table data into a csv file swiftguy121 Linux - Software 2 04-25-2007 07:28 PM
Reading Snort Text Log into Database willis3000 Linux - Software 0 03-10-2006 07:25 PM
storing text in a text file for a specified length of time. mrobertson Programming 7 08-02-2005 10:27 AM
bash; reading values from a file km4hr Programming 16 07-28-2005 02:07 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:31 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration