Load CSV data into a database


/ Published in: XML
Save to your folder(s)

This example demonstrates usage of Scriptella ETL Tool to load CSV data into a database table.


Copy this code and paste it in your HTML
  1. <!DOCTYPE etl SYSTEM "http://scriptella.javaforge.com/dtd/etl.dtd">
  2. <etl>
  3. <connection id="in" driver="csv" url="data.csv" classpath="opencsv.jar"/>
  4. <connection id="out" driver="oracle" url="jdbc:oracle:thin:@localhost:1521:ORCL"
  5. classpath="ojdbc14.jar" user="scott" password="tiger"/>
  6. <!-- Copy all CSV rows to a database table -->
  7. <query connection-id="in">
  8. <!-- Empty query means select all columns -->
  9. <script connection-id="out">
  10. INSERT INTO Table_Name VALUES (?id,?priority, ?summary, ?status)
  11. </script>
  12. </query>
  13. </etl>

URL: http://snippets.dzone.com/posts/show/3508

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.