<?xml version="1.0" encoding="UTF-8"?>
               
<load>   

  <!-- Login to this database.  -->
  <dbType>Oracle</dbType>
  <dbUrl>jdbc:oracle:thin:@localhost:1521:jddb</dbUrl>
  <dbUserName>scott</dbUserName>
  <dbPassword>tiger</dbPassword>
  <table>person</table>
  <sequence name="person_seq" pkColumn="person_id" />
  <sqlToGetExistingRowCount>select count(*) from person</sqlToGetExistingRowCount> 
  <sqlToRunBeforeLoad>delete from person</sqlToRunBeforeLoad> <!-- to append to table leave this blank -->

  <file pathAndName="testing/fixed-length/Test-fixed.txt" type="fixed" />  
  <skipLines top="5" />              

  <!-- load first column in first spreadsheet in work book to "name" column on "person" db table -->
	<column fieldNumber="1" dbColumn="name" type="String" start="0" end="9" >
    <validation errorWhen="notMatch" >     <!-- must be all letters, otherwise show the error message -->
      <regExp>^[A-Za-z]{1,100}$</regExp>
      <message>Invalid name. Name can't be blank and can't contain blanks, numbers, or special characters.</message>
    </validation>
    <validation errorWhen="match" >      <!-- Must not be blank  -->
      <message>Name can't be blank</message>
      <regExp>^ *$</regExp>
    </validation>
	</column>

  <!-- Note we skip the field "Shoe Size" in columns 10 thru 12, it isn't need on out database -->

	<column fieldNumber="2" dbColumn="nick_name" type="String" start="15" end="29" />

	<column fieldNumber="3" dbColumn="age" type="Integer" start="30" end="31">
    <validation errorWhen="notMatch" >
      <regExp>^\d{1,3}$</regExp>
      <message>Invalid age must be a number, maximum 3 digits.</message>
    </validation>
    <validation errorWhen="match" >
      <message>Age can't be blank</message>
      <regExp>^ *$</regExp>
    </validation>
	</column>

	<column fieldNumber="4" dbColumn="birthday" type="Date" start="34" end="43" >
    <validation errorWhen="notMatch" >
      <regExp>^\d\d/\d\d/\d\d\d\d$</regExp>
      <message>Invalid Date must be in format mm/dd/yyyy.</message>
    </validation>
    <simpleDateFormat>MM/dd/yyyy</simpleDateFormat>
    <!-- See http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html for docs on SimpleDateFormat -->
    <invalidDateErrorMessage>Invalid birthday</invalidDateErrorMessage>
	</column>

	<column fieldNumber="5" dbColumn="score" type="Float" start="45" end="48" />

	<column fieldNumber="6" type="String" dbColumn="favorite_food" start="51" end="100" />

	<column constantValue="Pin Pals" dbColumn="team_name" type="String" />

	<column sqlToGetValue="(sysdate)" dbColumn="created" />

</load>   
   

<!--

 Our fixed length data file has the following fields:

            Start  End 
  Name        0      9 
  Shoe       10     12 
  Nickname   15     29 
  Age        30     31 
  Birthday   34     43 
  Score      45     48 
  Fav Foods  51     100 

-->

  
