LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-14-2005, 01:53 AM   #1
neerajchaudhari
Member
 
Registered: Jun 2005
Location: Pune
Distribution: mandrake
Posts: 30

Rep: Reputation: 15
migrating data from mdb file to postgresql in linux


hello everyone,
i want to migrate my database which is in MDB format (Microsoft Accces Database) to the postgresql database in linux, i have the application ready which will perform the task, what kind of system settings, configruations shall i do to accomplish the task
waiting eagerly for the reply
thanks in advance
 
Old 09-14-2005, 02:57 AM   #2
neerajchaudhari
Member
 
Registered: Jun 2005
Location: Pune
Distribution: mandrake
Posts: 30

Original Poster
Rep: Reputation: 15
Connecting to MDB files in linux

hello everyone,
I am stuck up due to a problem
How do i connect to the MDB file in linux? through a java application
what drivers shall i install to accomplish the task

waiting eagerly for the reply
thanks in advance
 
Old 09-14-2005, 06:38 AM   #3
juvestar15
Member
 
Registered: Aug 2005
Location: Australia
Distribution: Debian Sid
Posts: 60

Rep: Reputation: 15
Is the file stored on your linux system or is it accessible from a server? I've had to do some research on this same topic for uni. We have to access a mdb file on a windows machine from our Linux server. Check up on "mdbtools" to see if it suits your needs.
 
Old 09-14-2005, 07:44 PM   #4
pddm
Member
 
Registered: Sep 2005
Distribution: Mint 19.2
Posts: 112

Rep: Reputation: 15
I assume you are familiar with postgreSQL that you have the daemon running and created an empty database etc etc.

The 1st step would be to take your access create table queries and transscribe them to postgresql as postgresql uses different field sizes (look in manual under data types)
Example:
CREATE TABLE "trans" (
"no" bigint DEFAULT nextval('"trans_no_seq"'::text) NOT NULL,
"shift_no" bigint,
"stamp" timestamp without time zone DEFAULT ('now'::text)::timestamp(6) with time zone,
"type" text,
"void" boolean DEFAULT 'f'::bool,
Constraint "trans_pkey" Primary Key ("no")
);


then create all your tables with their respective relations.

Backup your structure into a dump file.

Then migrate your data:
copy or export the data for each table and create a SQL file (Do NOT use Windows Notepad; as it screws up the lineends and make them unreadable in Linux); using the following format:

COPY "tablename" FROM stdin;
DataforField1[TAB]DataforField2[TAB]DataforField3[TAB]DataforField4 etc
\.

Example:
COPY "trans" FROM stdin;
108008 1775 2004-11-01 06:13:40.598339 Exchange f
108009 1775 2004-11-01 06:19:33.724516 Exchange f
108010 1775 2004-11-01 06:26:18.479672 Cash f
108011 1775 2004-11-01 06:26:36.295438 Cash f
\.

Keep in mind:
Date Time fields can easely be confused by the databse use yyyy-mm-dd
change your Yes/no True/False fields into t for true and f for talse (-1 and 0 will not work either)
postgre allows you to setthe number for an autonumeric field, so do not worry keeping your consecutives.

Upload the files to your server(you can use Secure File Transfer) to a place where the postgres user has access (iE /tmp)

then do:
bash-2.05b$ psql [database] -f /tmp/[Filename]
once for each file

Carefully watch the output for error messages and do the necesary changes to tables or data if needed.

in the worst case if something bad happens just drop the database and restore it from the dumpfile.
 
Old 09-15-2005, 03:20 AM   #5
neerajchaudhari
Member
 
Registered: Jun 2005
Location: Pune
Distribution: mandrake
Posts: 30

Original Poster
Rep: Reputation: 15
i have the MDB file on the linux machine itself
 
Old 09-15-2005, 01:13 PM   #6
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
The 2 identical threads have been merged. In future, please do not post the same question in more than one place.
 
Old 09-15-2005, 01:41 PM   #7
pddm
Member
 
Registered: Sep 2005
Distribution: Mint 19.2
Posts: 112

Rep: Reputation: 15
Oops
MDB files are MS proprietary (I don't know if an open source product has figured out how to read or export its data.

I would recommend you either copy it back to Win or open it through Windows File sharing. Open it in access.

Then follow the steps I posted before.
I also hope that the MDB only holds data and the whole application is not developed on it like forms and stuff.
 
Old 10-12-2005, 11:10 AM   #8
pddm
Member
 
Registered: Sep 2005
Distribution: Mint 19.2
Posts: 112

Rep: Reputation: 15
Good news for access users!

The upcoming version 2 of openoffice.org will have a database similar to Access called Base.

It will have support for opening Access mdbs

neerajchaudhari, you might be able to open the mdb files with the beta.
 
Old 10-12-2005, 12:05 PM   #9
khurdp
Member
 
Registered: Dec 2002
Location: Mumbai, India
Distribution: Fedora 2, Damn small linux
Posts: 30

Rep: Reputation: 15
Hello Neeraj,
I am not sure how I did this a long time back but if you have access to a MS machine, just dump all the tables to pipe delimited file(s) (from the MS machine) and read them back into postgreSQL (on Linux) provided the tables have been defined as explained in one of the earlier replies.

I remember it wasn't very difficult but wish it was much easier.

-Prasad

Last edited by khurdp; 10-12-2005 at 12:09 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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Access (mdb) file reader? logosys Linux - Software 2 08-31-2005 02:33 PM
read/write in *.MDB (MS-Access file) form Linux FC3 thuan1975 Linux - Software 1 08-11-2005 01:25 AM
Software to create a .mdb file? bruno buys Linux - Software 2 07-05-2004 05:44 PM
Beginners Only! PostGreSQL, PHP, Apache and RedHat 9.0 ! (migrating from windows2k) scorpatron LinuxQuestions.org Member Success Stories 3 11-14-2003 10:16 PM
convert text File to Access MDB Corinne Linux - Software 2 09-24-2002 05:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:53 PM.

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