Announcement Announcement Module
No announcement yet.
Writing to the multiple databases Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Writing to the multiple databases

    I have a requirement to load a file in two different databases. Is there any way to have multiple writers in single Step? Or i have to configure this as two seprate jobs.

  • #2
    you can have multiple writers for the same step by using a composite writer, but as each writer will write to its own database and Spring Batch uses the same transaction manager for a whole batch, you'll need to use JTA transactions (or use a feature like synonyms to let the database engine demarcate transactions on both databases). This will also coupled the writers together (a failure for one will imply a rollback for both).

    Perhaps you should use 2 different jobs, especially if the writes on each writer should be decoupled.