The invention discloses a method and
system for converting or
synchronizing databases. The method comprises the following steps of: reading a
data conversion and synchronization strategy set corresponding to a
target database from a configuration file;
polling target database connection information in the configuration file, and opening the
target database; reading the synchronization strategy, reading
SQL (structured
query language) statements in a source
database according to the organization of the synchronous strategy, and reading
source data from the source
database according to the
SQL statements; and inserting the data read from the source
database into the target database to carry out synchronization. According to the method and
system for converting or
synchronizing databases, disclosed by the invention, a mode of actively inserting the data stored in the source database and subjected to reading or conversion into the target database is adopted, so that the method and
system disclosed by the invention can be applied to a multi-source heterogeneous situation and a situation that the structure of the source database is inconsistent with the structure of the target database, and also can be used under the condition that the
source data is in a weak trend status but the target database is in a strong trend status, thereby adapting to different conversion
modes; and based on the method or system for
synchronizing databases, the structures of the source database and the target database are not destroyed.