LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-12-2004, 06:51 PM   #1
agallant
Member
 
Registered: Oct 2003
Location: D.C USA
Distribution: Redhat 9. Thinking about Slackware
Posts: 166

Rep: Reputation: 30
Postgre SQL


I need to automaticailly import .XLS, .CSV, .MDB in to Postgre sql database. any ideas on how to do this?
 
Old 05-12-2004, 09:32 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
I used the brute force method for lack anything better at the time.
I created a program that would convert the csv file to a SQL insert statement, adding in ' for strings and then posting the statement to the table.
Each table has the same structure so I didn't need to do any thing special.

The SQL statement:
insert into <table> values (xxx, 'data', yyyy)

For .mdb
http://mdbtools.sourceforge.net/

You also might be able to import the xls, csv file to Access and export from there.

I've never tried with Access but if you installed the Postgresql ODBC you might be able to connect directly to the database and copy directly.

Check out the Postgresql programming documentation on its website.

Last edited by michaelk; 05-12-2004 at 09:34 PM.
 
  


Reply



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
Default databases in Postgre SQL redhatrosh Linux - Software 6 11-18-2005 06:33 AM
Create User in Postgre Sql waynejkruse10 Linux - Software 7 09-05-2005 10:53 AM
PHP + PostGre Xing Linux - Software 0 10-07-2003 07:17 AM
(postgre) SQL question J_Szucs Programming 4 09-18-2003 08:40 PM
HowTo start Postgre sql daemon josedsilva Linux - Software 4 03-20-2003 06:05 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:36 AM.

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