Generate sql table dump from Base

Hi, is there a simple way to generate an SQL dump from a Base program?
I am running Libreoffice 6.3 on Windows and/or Lubuntu1604, and from the .odb file would like to generate an SQL dump, that I can then feed into another database. Below an example of a similar dump from an MS Access file:

CREATE DATABASE IF NOT EXISTS `movedb`;
USE `movedb`;

#
# Table structure for table 'tbl_106'
#

DROP TABLE IF EXISTS `tbl_106`;

CREATE TABLE `tbl_106` (
  `ID` INTEGER NOT NULL AUTO_INCREMENT, 
  `VOL` INTEGER, 
  `REC` INTEGER DEFAULT 0, 
  `PAG` INTEGER DEFAULT 0, 
  `INDX` VARCHAR(50), 
  `FOTO` INTEGER DEFAULT 0, 
  `FOTOLINK` LONGTEXT, 
  `ANNO` INTEGER, 
  `DATAIMMAGINE` DATETIME, 
  `TIPO` VARCHAR(50), 
  `CHIESA` VARCHAR(50), 
  `DA` INTEGER DEFAULT 0, 
  `A` INTEGER DEFAULT 0, 
  PRIMARY KEY (`ID`)
) ENGINE=myisam DEFAULT CHARSET=utf8;

#
# Dumping data for table 'tbl_106'
#

INSERT INTO `tbl_106` (`ID`, `VOL`, `REC`, `PAG`, `INDX`, `FOTO`, `FOTOLINK`, `ANNO`, `DATAIMMAGINE`, `TIPO`, `CHIESA`, `DA`, `A`) VALUES (413, 106, NULL, 1, NULL, 5417, 'cataldo106_001_5417#C:\\d\\access\\erice casa sales 2019/vol 106/cataldo106_001_5417.PAG 01.jpg#', 1675, '2019-08-24 00:00:00', 'Matrimoni', 'S.Cataldo', 1675, 1686);

Hello,

There is no facility in Base to create this. Base, using defaults, are embedded databases and copying the Base file is essentially a backup. If using an external database that database will typically provide a utility to create a backup or sql file (usually a choice you can make).

Now your question does not state the to/from databases. Previous questions refer to Firebird. With Base and Firebird embedded, the database is in the .odb and can be extracted with most archive managers. Firebird has a utility gbak which is a backup and restore utility. This may be of help.

Thanks for your reply. I had a look at gbak but could not generate what I needed.
Other options I looked at included scripts using “Create Text Table; Set Table; Insert Into” to generate a .csv file containing the database tables (suggested by another post) but these do not seem to be available with Firebird.

In the end I did manage to generate exactly what was required (i.e. a dump.sql file with all the CREATE TABLE and INSERT INTO TABLE necessary to import all the tables) by using a commercial product called RazorSQL. This worked perfectly and in a few seconds I had the .sql dump.

1 Like