jDbSync jDBSync
Core Tasks

SourceForge.net Logo

Export task

This task is used to export data from DB to XML file.

There are two ways to use this task:

  • Extract content of all tables from DB schema. DB schema can be specify either with "schema" attribute or as schema will be used value of "userid" attribute
  • Extract content of tables which are needed. To do it you need to add nested <table> elements.

Java class is org.chur.ant.db.jdbsynch.export.ExportTask

Parameters

Attribute nameDescriptionRequiredDefault
driverClass name of the jdbc driverYes – 
urlDatabase connection urlYes – 
useridDatabase user nameYes – 
passwordDatabase passwordYes – 
schemaName of DB schema.No"userid" value
destOutput file for resultYes – 
encodingOutput file encodingNoUTF-8
profile DB profile which will be used to convert data at the export time. If value is not present then DB profile will be detected according to <url> attribute. Out-of-box are supported the following profiles: If DB type cannot be identified "common" profile is used. Nodepends on url
profileClass Class name which should implement DB profile (org.chur.ant.db.profiles.DBProfile). If specified "profile" attribute this value will be ignored. No – 

Parameters specified as nested elements

table

Use nested <table> elements to specify which tables should be exported. If there are no any <table> elements all tables in user's DB schema are exported.

sql

Use nested <sql> elements if you need to change some DB session's attributes or prepare some data before export will be started.

Examples

<taskdef name="export" classname="org.chur.ant.db.jdbsynch.export.ExportTask"/>
<export
	driver="oracle.jdbc.OracleDriver"
	url="jdbc:oracle:thin:@tiger:1521:tigerdb"
	userid="sys"
	password="change_on_install"
	schema="SCOTT"
	dest="export1.xml"/>

Connect to DB "tigerdb" and export all tables from "SCOTT" schema to "export1.xml" file.

<taskdef name="export" classname="org.chur.ant.db.jdbsynch.export.ExportTask"/>
<export
	driver="oracle.jdbc.OracleDriver"
	url="jdbc:oracle:thin:@tiger:1521:tigerdb"
	userid="sys"
	password="change_on_install"
	dest="export1.xml"
	profile="mysql">
		<sql>ALTER SESSION SET CURRENT_SCHEMA=SCOTT</sql>
		<table tableName="CUSTOMERS"/>
		<table tableName="CITIES"/>
	</export>

Connect to DB "tigerdb" and export all data from two tables (CUSTOMERS and CITIES) from "SCOTT" schema to "export1.xml" file. To connect is used "sys" login. After login and before do export current schema will be changed to SCOTT. To convert data will be used profile of MySQL.