<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="en-us" xml:lang="en-us"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="security" content="public" /> <meta name="Robots" content="index,follow" /> <meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' /> <meta name="DC.Type" content="concept" /> <meta name="DC.Title" content="Use DataLinks" /> <meta name="abstract" content="The DataLink data type is one of the basic building blocks for extending the types of data that can be stored in database files. The idea of a DataLink is that the actual data stored in the column is only a pointer to the object." /> <meta name="description" content="The DataLink data type is one of the basic building blocks for extending the types of data that can be stored in database files. The idea of a DataLink is that the actual data stored in the column is only a pointer to the object." /> <meta name="DC.subject" content="data types, DataLinks" /> <meta name="keywords" content="data types, DataLinks" /> <meta name="DC.Relation" scheme="URI" content="rbafyusoocap.htm" /> <meta name="DC.Relation" scheme="URI" content="rbafydlnolink.htm" /> <meta name="DC.Relation" scheme="URI" content="rbafydlcommands.htm" /> <meta name="DC.Relation" scheme="URI" content="../db2/rbafzmstch2data.htm" /> <meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" /> <meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" /> <meta name="DC.Format" content="XHTML" /> <meta name="DC.Identifier" content="rbafydatalinks" /> <meta name="DC.Language" content="en-us" /> <!-- All rights reserved. Licensed Materials Property of IBM --> <!-- US Government Users Restricted Rights --> <!-- Use, duplication or disclosure restricted by --> <!-- GSA ADP Schedule Contract with IBM Corp. --> <link rel="stylesheet" type="text/css" href="./ibmdita.css" /> <link rel="stylesheet" type="text/css" href="./ic.css" /> <title>Use DataLinks</title> </head> <body id="rbafydatalinks"><a name="rbafydatalinks"><!-- --></a> <!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script> <h1 class="topictitle1">Use DataLinks</h1> <div><p>The DataLink data type is one of the basic building blocks for extending the types of data that can be stored in database files. The idea of a DataLink is that the actual data stored in the column is only a pointer to the object.</p> <p>This object can be anything, an image file, a voice recording, a text file, and so on. The method used for resolving to the object is to store a Uniform Resource Locator (URL). This means that a row in a table can be used to contain information about the object in traditional data types, and the object itself can be referenced using the DataLink data type. The user can use SQL scalar functions to get back the path to the object and the server on which the object is stored (see Built-in functions in the SQL Reference). With the DataLink data type, there is a fairly loose relationship between the row and the object. For instance, deleting a row will sever the relationship to the object referenced by the DataLink, but the object itself might not be deleted.</p> <p>A table created with a DataLink column can be used to hold information about an object, without actually containing the object itself. This concept gives the user much more flexibility in the types of data that can be managed using a table. If, for instance, the user has thousands of video clips stored in the integrated file system of their server, they may want to use an SQL table to contain information about these video clips. But since the user already has the objects stored in a directory, they only want the SQL table to contain references to the objects, not the actual bytes of storage. A good solution is to use DataLinks. The SQL table uses traditional SQL data types to contain information about each clip, such as title, length, date, and so on. But the clip itself is referenced using a DataLink column. Each row in the table stores a URL for the object and an optional comment. Then an application that is working with the clips can retrieve the URL using SQL interfaces, and then use a browser or other playback software to work with the URL and display the video clip.</p> <p>There are several advantages of using this technique:</p> <ul><li>The integrated file system can store any type of stream file.</li> <li>The integrated file system can store extremely large objects, that does not fit into a character column, or perhaps even a LOB column.</li> <li>The hierarchical nature of the integrated file system is well-suited to organizing and working with the stream file objects.</li> <li>By leaving the bytes of the object outside the database and in the integrated file system, applications can achieve better performance by allowing the SQL runtime engine to handle queries and reports, and allowing the file system to handle streaming of video, displaying images, text, and so on.</li> </ul> <p>Using DataLinks also gives control over the objects while they are in "linked" status. A DataLink column can be created such that the referenced object cannot be deleted, moved, or renamed while there is a row in the SQL table that references that object. This object are considered linked. Once the row containing that reference is deleted, the object is unlinked. To understand this concept fully, one should know the levels of control that can be specified when creating a DataLink column.</p> </div> <div> <ul class="ullinks"> <li class="ulchildlink"><strong><a href="rbafydlnolink.htm">Link control levels in DataLinks</a></strong><br /> You can create a DataLink column with different link controls.</li> <li class="ulchildlink"><strong><a href="rbafydlcommands.htm">Commands used for working with DataLinks</a></strong><br /> Support for the DataLink data type can be broken down into three different components.</li> </ul> <div class="familylinks"> <div class="parentlink"><strong>Parent topic:</strong> <a href="rbafyusoocap.htm" title="Most data types, such as INTEGER and CHARACTER, do not have any special processing characteristics. However, there are a few data types that require special functions or locators in order to use them.">Process special data types</a></div> </div> <div class="relinfo"><strong>Related information</strong><br /> <div><a href="../db2/rbafzmstch2data.htm">Data types</a></div> </div> </div> </body> </html>