DB2 Data Links Manager Quick Beginnings

1. Creating a test environment on the DB2 UDB server

To create a test environment on the DB2 UDB server:

  1. Log on to the system as a user with root authority.
  2. Create an instance on the DB2 server using the db2icrt command. This instance will contain a database where tables containing columns of the DATALINK data type will reside. For more information on creating instances, refer to the Administration Guide: Planning.

    In our example, we will create an instance called VALIDATE by entering the following commands:

       mkgroup testers
       mkuser pgrp='testers' groups='testers' home='/home/validate' validate
          /usr/lpp/db2_07_01/instance/db2icrt -u validate validate
    
  3. Log out.
  4. Log on to the system with a valid DB2 user ID that has System Administrative (SYSADM) authority on the VALIDATE instance that you created. By default, any user that belongs to the primary group of the instance owner has SYSADM authority on an instance. For more information, refer to your server's Quick Beginnings manual.
  5. Ensure that the VALIDATE instance is the current instance by entering the following command:
       db2 get instance
    

    This command should return the following output:

        The current database manager instance is:  VALIDATE
    

    If you did not receive this output, enter the following commands:

       set DB2INSTANCE=VALIDATE
       db2 get instance
    
  6. Set the DATALINKS database manager configuration parameter to YES in the VALIDATE instance's configuration file by entering the following command:
       db2 update dbm cfg using datalinks yes
    

    To disable DB2 Data Links Manager functionality on your DB2 server, set the DATALINKS database manager configuration parameter to no.

  7. Start the VALIDATE instance by entering the db2start command.
    Note:If you change a setting in an instance's database manager configuration file, you must ensure that you stop and restart the instance (using the db2stop and db2start commands) for the changes to take effect. In our example, we had not started the VALIDATE instance and that is why we only issued the db2start command. For more information, refer to the Administration Guide.
  8. Create a database using the db2 create database command. This database will contain a table using the DATALINK data type. For more information on the db2 create database command, refer to the Command Reference.

    For our example, create a database called STAFF by entering the following command:

       db2 create database staff
    
  9. Connect to the STAFF database by entering the following command:
       db2 connect to staff 
    
  10. Create a table called EMPLOYEE, in the STAFF database that you just created, that has a column defined with a DATALINK data type by entering the following command:
     db2 "create table employee (id int, fname varchar(30), lname varchar(30),
          picture datalink linktype url file link control integrity all
          read permission db write permission blocked recovery yes on
          unlink restore)"
    
  11. Terminate all connections to this database by entering the following command:
        db2 connect reset
    
  12. Log out.


[ Top of Page | Previous Page | Next Page ]