Posted By

ejboy on 02/23/07


database xml jdbc etl scriptella

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Copy table from one database to another

 / Published in: XML


This Scriptella ETL script copies all rows from SrcTable to DestTable. SrcTable contains the following columns: id, firstname, lastname DestTable contains the following columns: id, name The name column of the DestTable is produced by a concatenation of firstname and lastname from the SrcTable This example demonstrates HSQLDB-To-Oracle copy procedure, although it works between virtually any databases.

  1. <!DOCTYPE etl SYSTEM "">
  2. <etl>
  3. <connection id="in" driver="hsqldb" url="jdbc:hsqldb:file:demo"
  4. classpath="hsqldb.jar" user="sa"/>
  5. <connection id="out" driver="oracle" url="jdbc:oracle:thin:@localhost:1521:ORCL"
  6. classpath="ojdbc14.jar" user="scott" password="tiger"/>
  7. <!-- Copy all table rows from one to another database -->
  8. <query connection-id="in">
  9. SELECT * FROM Src_Table --Selects all rows
  10. <!-- For each row executes insert -->
  11. <script connection-id="out">
  12. INSERT INTO Dest_Table(ID, Name)
  13. VALUES (?id,?{first_name+' '+last_name})
  14. </script>
  15. </query>
  16. </etl>

Report this snippet  

You need to login to post a comment.