Glen Urban November 19 2009 12:30:29 PM
DCRs allow developers to use Domino Designer to create connections from their Notes/Domino application to "enterprise" data in relational databases such as MS SQL, DB2, Oracle or any other data source that has an ODBC driver. It uses DECS technology and as a prerequisite DECS must be installed and running on the server. Once you've configured a DCR, and a corresponding Notes form, any data updated on the Notes form will update your back end data and, similarly, any updates to the back end data will be reflected on your Notes form.
DCRs are targeted at developers where as DECs are seen as more of an administrator tool. In reality either tool can be used to achieve the same goal but today I am looking at DCRs from a developers point of view. Having said that the first two steps would normally be seen as the role of your Domino server administrator and not a developer.
1. Ensure DECS is installed and running on the server. DECS is an option in the server tasks to include when you install a new server. If you want to add the DECS task to an existing server ensure that the notes.ini "ServerTasks=" line has an entry for "DECS" and on a separate line add the entry "EXTMGR_ADDINS=decsext"
ServerTasks=....., DECS
EXTMGR_ADDINS=decsext
2. Use the ODBC data Source Administrator to create a Data Source. (I'm assuming we are using a Windows server here)
On the Domino server where your Notes application will reside open the ODBC administrator (usually found in Control Panel -> Administrative Tools -> Data Sources) and create a System DSN connection to your enterprise database.

Once you've pressed the "Add.." button the exact procedure will depend upon the specific ODBC driver for your back end data source.
3. Create the DCR in Domino Designer Depending upon which version of the designer client you are using a DCR is created in under Data -> Data Connections (8.5) or under Shared Resources -> Data Connections (6.5 and 7)
Press the "New Data Connection Resource" button. We are using an ODBC source so under type choose "ODBC" and for "Name" enter the name of the ODBC data source you created in step 2.
There is an option for a user name and password here but for an ODBC connection I would define those when you create the DSN in step 2.
You have the option to select a specific table/view to use for this DCR but can leave this blank and choose these later.
4. Set the Database Property Set the database property "Allow connections to external databases using DCRs"
You will need to close and re-open the database before this option is recognised.

5. Design your Form Now you can add fields to a form and define the mapping to your external database. Select the tick box "External data source" on the first tab of the Field properties and a further set of Data Source Options appear at the bottom of the dialog box.

Press "Browse" and select the DCR you defined in step 3. Then select the Table and Field in the external database that your Notes field maps to.
Your Notes form must have a Key field that corresponds to the primary key in your external data source. This Key field value will always be stored in the Notes document to maintain the link with your external data. For other fields you have the option to "store data locally". Storing your data locally allows you to use the data in views but if the back end data changes the your view maybe out of date until your Notes document is opened and saved again.
6. Import the Data to your Notes Database Before importing any data you must turn off the database property "Allow connections to external databases using DCRs" (turned on in step 4).
From Domino designer select the DCR you created and when you press the "Import External Records" button you will then be prompted to select for which Form you want to import the data. Corresponding documents will be created for each record in your external data.
Once you turn back on the database property "Allow connections to external databases using DCRs" you will be ready to use your application.
Important Considerations If a new record is added in your back end data a corresponding document will not be added to your Notes database. If this is a must then may want to consider other options such as Lotus Enterprise Integrator.
Creating a new document in your Notes application can create a corresponding record in your back end data. There is an option on the second properties tab of the DCR called "Action on missing record" that dictates what happens in this instance.