将表从一个数据库复制到另一个数据库
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了将表从一个数据库复制到另一个数据库相关的知识,希望对你有一定的参考价值。
This Scriptella ETL script copies all rows from Src_Table to Dest_Table.Src_Table contains the following columns: id, first_name, last_name
Dest_Table contains the following columns: id, name
The name column of the Dest_Table is produced by a concatenation of first_name and last_name from the Src_Table
This example demonstrates HSQLDB-To-Oracle copy procedure, although it works between virtually any databases.
<!DOCTYPE etl SYSTEM "http://scriptella.javaforge.com/dtd/etl.dtd"> <etl> <connection id="in" driver="hsqldb" url="jdbc:hsqldb:file:demo" classpath="hsqldb.jar" user="sa"/> <connection id="out" driver="oracle" url="jdbc:oracle:thin:@localhost:1521:ORCL" classpath="ojdbc14.jar" user="scott" password="tiger"/> <!-- Copy all table rows from one to another database --> <query connection-id="in"> SELECT * FROM Src_Table --Selects all rows <!-- For each row executes insert --> <script connection-id="out"> INSERT INTO Dest_Table(ID, Name) VALUES (?id,?{first_name+' '+last_name}) </script> </query> </etl>
以上是关于将表从一个数据库复制到另一个数据库的主要内容,如果未能解决你的问题,请参考以下文章