Class JdbcUpsertCSV

  • All Implemented Interfaces:
    AdaptrisComponent, ComponentLifecycle, ComponentLifecycleExtension, ConnectedService, MessageEventGenerator, Service, StateManagedComponent

    @ComponentProfile(summary="Insert/Update a CSV file into a database",
                      tag="service,csv,jdbc",
                      since="3.6.5")
    public class JdbcUpsertCSV
    extends JdbcMapUpsert
    Convenience service for inserting/updating records in a database based on a CSV file.

     
       firstname, lastname, dob,id
       alice, smith, 2017-01-01,1234
       
     
    will effectively execute the following statement INSERT INTO table (firstname,lastname,dob,id) VALUES (?,?,?,?) or UPDATE table SET firstname=?, lastname=?, dob=? WHERE id = ?; if 1234 already exists as a row.

    Note that no parsing/assertion of the column names will be done, so if they are invalid SQL columns then it's going to be fail.

    Since:
    3.6.5

    In the adapter configuration file this class is aliased as csv-jdbc-batch-insert which is the preferred alternative to the fully qualified classname when building your configuration.