Ask Your Question

SQL to synchronize local/offline DB and remote DB ?

asked 2019-10-03 20:49:32 +0200

intmail01 gravatar image


The goal is to use off line data base with the built in L.O data base engine. When network become available, run sql code to transfer the local data to the remote postgresql server.

Is it possible to write SQL code to work with the 2 data bases ?

Thank you

edit retag flag offensive close merge delete


Cross posted here -> How to use off line/cache database and synchronise with online server

@intmail01 if you do this, please note in each posting that the question was also posted in XXXX. Eliminates needless duplication.

And curious as to why you did this almost one full day after an answer was provided here but you never responded to?

Ratslinger gravatar imageRatslinger ( 2019-10-05 20:23:53 +0200 )edit

It is not duplication like copy/paste. Each person have his manner and flavor to explain because each person is different. I want even to post on other language because I am not very good in english. I go elsewhere because you said that some technics and technologies can not be explained here because the main goal here is L.O. For example what is JDBC and what are technologies and software to mix two database

intmail01 gravatar imageintmail01 ( 2019-10-05 21:10:38 +0200 )edit

Duplication is not just copy/paste. Both questions deal with LO and local database and a remote PostgreSQL DB. Neither talked of JDBC which is just a type of connection like your 'PostgreSQL' connection or ODBC. A look at the LO documentation explains many of these things.

It was also stated there is too much to consider. You could literally write books on the topic.

Even in different language you should mention cross post as I and others have answered questions in those forums also.

Ratslinger gravatar imageRatslinger ( 2019-10-05 21:22:08 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2019-10-03 22:33:50 +0200

Ratslinger gravatar image


Don't believe you have thought of how Base works.

You create a Base file. While creating this file you establish what database you are connecting to. If you connect to an embedded database, you are stuck with that connection for that Base File.

If you make the connection other than an embedded database, you can actually change that connection to a different database and even a different type such as MySQL to PostgreSQL. It is not recommended but can be done. Now even though you can do this, you are still only connected to one database.

Although it would need much consideration as to ALL the implications of doing what you ask, you may have one non-embedded database and connection locally for off-line processing and another to connect to the main server.

Now, again, you are typically not going to use SQL to transfer the data. Your solution (depending upon databases used) may be a third party utility to pump data from one table/database to another. But even this will be tricky as to what type of data/relations there may be.

There is too much to consider to discuss here and that further discussion is not even a topic for this forum as it does no concern LO.

As for SQL working with two databases, SQL depends mostly upon table names, field names and functions. If all are the same SQL should work.

edit flag offensive delete link more


As with any answer to any question, if this answers your question please tick the ✔ (upper left area of answer). It helps others to know there was an accepted answer.

Ratslinger gravatar imageRatslinger ( 2019-10-04 20:10:57 +0200 )edit

And to answer you poorly stated question (clarified more in linked question), with Base and an embedded DB you cannot use SQL to deal with two different databases.

You can connect to a different database and access through SQL by using macros. But this is only going to add to the complexity of what you propose. So the macro needs to read one DB and update another. Have done that and it takes lots of time and thought and considerable macro knowledge to plan out.

Additionally, it you have read the answer you see it mentions there is a connection to a SINGLE database. Therefore you cannot:

INSERT ... TO ... database.table ...

(where 'database.table' is other than the current connection) as you state in the other post.

Ratslinger gravatar imageRatslinger ( 2019-10-05 20:35:14 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-10-03 20:49:32 +0200

Seen: 283 times

Last updated: Oct 03 '19