Mapping File Example
This example illustrates how the two forms of the DEF lines can be used to read from an ODBC database source, which is named rogers.
READER_TYPE ODBC2 ODBC2_DATASET rogers # As we are reading from an MS-ACCESS database, we don’t need to # specify these: # DATABASE_USER_NAME <userName> # DATABASE_PASSWORD <password> # Form 1 of the DEF line is used like this -- it reads just # the two fields we list and applies the where clause ODBC2_DEF supplier \ odbc2_where_clause "id < 5" \ ID integer \ CITY char(50) # Form 2 of the DEF line is used like this -- we let SQL # figure out what fields we want and do a complex join # involving 3 tables. The FME features will have whatever # fields are relevant. The "feature type" as far as # FME is concerned is whatever was put on the DEF line. # In this case "complex" is the feature type, even though no # table named "complex" is present in the database. ODBC2_DEF complex \ odbc2_sql "SELECT CUSTOMER.NAME, CUSTOMER.ID,
VIDEOS.ID, VIDEOS.TITLE FROM RENTALS, CUSTOMER,
VIDEOS WHERE RENTALS.customerID = CUSTOMER.ID AND
VIDEOS.ID = RENTALS.videoID AND CUSTOMER.ID = 1" # Finally, define the NULL writer as our output -- we will # just log everything we read to the log file for inspection. WRITER_TYPE NULL NULL_DATASET null FACTORY_DEF * SamplingFactory \ INPUT FEATURE_TYPE * @Log()