Tuesday, August 23, 2011

Exporting from OpenOffice Base database to SQL

I was wanting to export the contents and design of an OpenOffice.org Base database to SQL with the intent of migrating to MySQL. I struggled to find out how to do this, but finally found out how.

To generate an SQL file that contains both the contents and the data of the database I used the following command from the “Tools –> SQL…” menu:

SCRIPT 'C:\temp\file.sql'

When I tried to write it to the C:\ root directory I got a security error, but using another directory worked fine.

Thanks to http://www.oooforum.org/forum/viewtopic.phtml?t=32333 for pointing me in the right direction.

Incidentally, on my way to the final solution I also came across the following command to generate a CSV file of a table’s contents:

SELECT * INTO TEXT "output_csv_file_name" FROM "table_name"

The version of OpenOffice I was using was OpenOffice.org 3.3.0 – OOO330m20 (Build:9567) and I running this on a Windows 7 machine.


  1. Wow - nice job, especially SCRIPT solution.
    Just looking for that.
    And it works!


  2. Works great! Saved my day!

  3. that's what i've been looking for :)