Tuesday, February 19, 2008

Open the Borders of accessing data:

We who program on the iSeries tend to be isolationists when it comes to our data. We store what we need for our applications, and nothing more. If there is desired data in the outside world, we usually attempt to replicate it locally, instead of figuring out how to access it remotely. Well, with DB2 UDB on the iSeries, we now have the capability to pull our heads out of the sand and check out the data the rest of the world has to offer.

Local data is not all that DB2 UDB can handle. It can also access external data using a feature called DataLinks. DataLinks are pointers, or logical views, to data that resides on another server or on the Integrated File System (IFS) of the same server.
The pointer to external data is contained within a column of type DataLink and is stored in the form of a URL. The rest of the row is used to store information about the external data. A practical use of datalinks might be a video store database or any database that includes images, such as an item file or employee master file. In either case, the descriptive information can be stored locally, in DB2, where queries, reports, and maintenance can be easily and quickly accomplished, while the video or image data would be stored on a remote server and only retrieved when necessary. The following SQL code fragment demonstrates how you would define a DataLink column in a DB2 table:
Create Table Rental (
Cust_ID Integer,
Name VarChar (50),
Video_ID Integer,
Description VarChar (50),
Length Integer
Clip Datalink (40))

There are three ways in which a DataLink can be linked to, or can "control," external data: no control, file link control with IFS permissions, and file link control with DB2 permissions.

The data link file manager, or DLFM, keeps track of the link statuses for files on a server. It handles the necessary linking, unlinking, and commitment control tasks. In order for the DLFM or DataLinks in general to work, you must have TCP/IP configured on both the server where the DB2 tables containing the datalink exist and the server that contains the linked objects.

Data links is a very powerful feature of DB2 UDB and it can help you organize your enterprise data, even if that data resides on disparate machines.

No comments: