jDbSync jDBSync
Core Tasks

SourceForge.net Logo

Field task

This task is used as nested element of the <table> task to define exactly the table structure.

If you have JDBC driver older then 1.2 you should use this task to specify table structure manually because old JDBC drivers don't have some methods to retrive metadata (for example java.sql.PreparedStatement.getMetaData).

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

Parameters

Attribute nameDescriptionRequiredTypeDefault
nameThe name of field in a tableYesString  – 
typeThe SQL type of field (should be set according to java.sql.Types values) YesInteger – 
pkPrimary key identifier. True if field is in primary key and false if not. NoBooleanfalse

Examples

<taskdef name="export" classname="org.chur.ant.db.jdbsynch.export.ExportTask"/>
<export
	driver="COM.ibm.db2.jdbc.net.DB2Driver"
	url="jdbc:db2://localhost:50010/DB2"
	userid="userdb"
	password="password"
	dest="export1.xml">
		<table tableName="CUSTOMERS">

			<field name="CUSTOMERID" type="4" pk="true"/>
			<field name="FIRST_NAME" type="12"/>
			<field name="LAST_NAME" type="12"/>

		</table>
	</export>
			

Extract all data from table CUSTOMERS and columns CUSTOMERID, FIRST_NAME and LAST_NAME.