Now, that you have an understanding of how to model rules that read from a database, let’s look at how to model rules that write to a database. There are two scenarios in which you write to a database:

  • You need to model a rule that adds a new record
  • You need to model a rule that updates an existing record

Similar to reading records, if the Vocabulary is mapped to a database, any rule that uses the Vocabulary can perform write operations on the database. For this to work, the database needs the primary key. The primary key value can be specified in the following ways:

  • If a new record needs to be added:
    • The primary key can come from Corticon—either supplied through an input message or defined in a rule, or,
    • The database can be configured to assign the primary key through identities (in Microsoft SQL Server) or sequences (in Oracle). Note: This way of assigning a primary key is not covered in this tutorial. To learn more, see the “Identity Strategies” section of the Data Integration guide.
  • If an existing record needs to be updated, the primary key must come from Corticon—either supplied through an input message or defined in a rule.