2

I'm getting data as an Access file.

My application uses PostgreSQL/Java. I'd like to convert the Access database to PostgreSQL. can any one help me to code this

ess
  • 663
  • 3
  • 9
  • 17
  • show us your code so we may help you – Tien Nguyen Dec 26 '13 at 06:36
  • thanks Nguyen...i have done code to connect ms access and postgres(two seperate connection).i dont know how to continue...how to get the table structure... – ess Dec 26 '13 at 06:37
  • Can you create an ODBC DSN which points to your PostGreSQL db, and then use [DoCmd.TransferDatabase](http://msdn.microsoft.com/en-us/library/office/ff196455(v=office.14).aspx) from an Access session? – HansUp Dec 26 '13 at 16:15
  • @HansUp can u explain DoCmd.TransferDatabase it is VB is nt it.... i dont know VB – ess Dec 27 '13 at 04:49
  • From within Access, you would use VBA. But that is probably not appealing for you either. There is also a feature, "export to ODBC", available in the Access user interface which does the same but without needing to use VBA. – HansUp Dec 27 '13 at 05:33
  • 1
    Possible duplicate of [Convert Access to PostgreSQL?](https://stackoverflow.com/questions/637147/convert-access-to-postgresql) – mic Aug 09 '19 at 19:23

1 Answers1

0

I doubt there is any simple automatic method. You will have to create ddl statements to make the tables in postgresql (not sure if you can export ddl from access), export the data from access to a csv, and then use postgresql copy from command to populate the tables.

Or you could consider trying this tool:

http://docman.sourceforge.net/home_html/projects/sql/exportSQL3.txt

but it looks like a dev version, it may not be mature.

James King
  • 6,229
  • 3
  • 25
  • 40
  • I thought you just needed to do a one time conversion. You need to write a java program that will convert MS Access databases to postgresql databases? This sounds like a very big project. I think you need to show us what you've coded so far. – James King Dec 26 '13 at 07:07
  • .i have done code to connect ms access and postgres(two seperate connection).i dont know how to continue...how to get the table structure. – ess Dec 26 '13 at 07:19
  • Neither do I, unfortunately. If this were Oracle you could pull it out of the metadata. I think you need someone who knows access better than I do. – James King Dec 26 '13 at 07:30