Ask Your Question
0

generate sql table dump from Base

asked 2020-02-28 16:48:51 +0200

nexturejohn gravatar image

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);
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2020-02-29 23:14:05 +0200

Ratslinger gravatar image

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.

edit flag offensive delete link more

Comments

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.

nexturejohn gravatar imagenexturejohn ( 2020-03-01 10:22:54 +0200 )edit
0

answered 2020-03-01 10:23:23 +0200

nexturejohn gravatar image

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.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-02-28 16:48:51 +0200

Seen: 83 times

Last updated: Mar 01