The assignment of a value to a DATALINK column results in the establishment of a link to a file unless the linkage attributes of the value are empty or the column is defined with NO LINK CONTROL. In cases where a linked value already exists in the column, that file is unlinked. Assigning a null value where a linked value already exists also unlinks the file associated with the old value.
If the application provides the same data location as already exists in the column, the link is retained. There are two reasons that this might be done:
A DATALINK value may be assigned to a column in any of the following ways:
When assigning a value to a DATALINK column, the following error conditions return SQLSTATE 428D1:
Note that the size of a URL parameter or function result is the same on both input or output and is bound by the length of the DATALINK column. However, in some cases the URL value returned has an access token attached. In situations where this is possible, the output location must have sufficient storage space for the access token and the length of the DATALINK column. Hence, the actual length of the comment and URL in its fully expanded form, including any default URL scheme or default hostname, provided on input should be restricted to accomodate the output storage space. If the restricted length is exceeded, this error is raised.
When the assignment is also creating a link, the following errors can occur:
Note that this error will be raised even if the link is to a different database.
In addition, when the assignment removes an existing link, the following errors can occur:
A DATALINK value may be retrieved from the database in either of the following ways:
Note that usually no attempt is made to access the file server at retrieval time. 17 It is therefore possible that subsequent attempts to access the file server through file system commands might fail.
When retrieving a DATALINK, the registry of file servers at the database server is checked to confirm that the file server is still registered with the database server (SQLSTATE 55022). In addition, a warning may be returned when retrieving a DATALINK value because the table is in reconcile pending or reconcile not possible state (SQLSTATE 01627).