Blog
DB2utor

Categories

December 06, 2011

Defining a DDF Location Alias

Recently I introduced the MODIFY DDF command in DB2 10 and explained how it can be used to STOP and START connections to support maintenance windows. MODIFY DDF can also be used to define DDF locations so you can manage subsets of data sharing members dynamically (online) without the need to stop and restart DDF or DB2. Applications can use the alias parameter in a non-data sharing environment to avoid application changes later when converting to a data sharing environment.

This example shows how you can add a new alias, set the port number then start the alias to allow applications to begin connecting.

-MOD DDF ALIAS(TROYDB) ADD
-MOD DDF ALIAS(TROYDB) PORT(5156)
-MOD DDF ALIAS(TROYDB) IPV4(141.202.65.11)
-MOD DDF ALIAS(TROYDB) START

Forgetting to start the alias or issuing the MODIFY ALIAS STOP comment results in this error:

Could not connect to TROYDB.
  Error creating SQL Model Connection connection to TROYDB.
           (Error: No start database command was issued. ErrorCode = -4499, SQLState = 08001.)
            No start database command was issued. ErrorCode = -4499, SQLState = 08001.
  Error creating JDBC Connection connection to TROYDB.
          (Error: No start database command was issued. ErrorCode = -4499, SQLState = 08001.)
           No start database command was issued. ErrorCode = -4499, SQLState = 08001

Using MODIFY DDF with the alias parameter provides some flexibility by separating the database name from the location name defined in job DSNJU003. You can then define member-specific IP addresses for the location alias created with MODIFY DDF. You can get information on what aliases are defined by using the DISPLAY DDF comment. Here's an example:

DSNL080I  !D10A DSNLTDDF DISPLAY DDF REPORT FOLLOWS:           
DSNL081I STATUS=STARTD                                         
DSNL082I LOCATION           LUNAME            GENERICLU        
DSNL083I D10APTIB           USILDA01.D10ADB2  -NONE            
DSNL084I TCPPORT=4276  SECPORT=4278  RESPORT=4277  IPNAME=-NONE
DSNL085I IPADDR=::141.202.65.11                                
DSNL086I SQL    DOMAIN=usazcp31.ca.com                         
DSNL087I ALIAS              PORT  SECPORT STATUS               
DSNL088I TROYDB             4276  4278    STARTD               
DSNL105I CURRENT DDF OPTIONS ARE:                              
DSNL106I PKGREL = COMMIT                                       
DSNL099I DSNLTDDF DISPLAY DDF REPORT COMPLETE

The capability to modify the alias and change the port numbers and/or the IPADDR without taking down DDF or DB2 is a great enhancement. You should look into how MODIFY DDF can help you better manage your application servers.