When you are debugging a stored procedure on a local database, it is possible to receive error number SQL1224N:
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver] SQL1224N A database agent could not be started to service a request, or was terminated as a result of a database system shutdown or a force command. SQLSTATE=55032
This is due to a problem in the Linux® kernel (Linux kernel Bugzilla bug #351). The following instructions are a work-around that uses DB2's TCPIP connection method (as a loopback) instead of Call Level Interface (CLI). With this procedure, the debugger will use the same database alias as before:
Steps 2 to 7 require you log in as the DB2 instance owner.
db2set db2comm
If the output does not contain the keyword tcpip, you need to enter the following command to update the db2comm registry variable to include tcpip:
db2set db2comm=<existing protocol names>,tcpip
The db2comm registry variable determines which protocol's connection manager will be enabled when the database manager is started. You can set this variable for multiple communication protocols by separating the keywords with commas, for example, db2set db2comm=tcpip,appc.
You need to re-issue the db2start command in order to start the connection managers for the protocols specified by the db2comm registry parameter. Since we will restart DB2 in step 7, there is no need to now.
.To check the current setting of SVCENAME, enter the following command:
db2 get dbm cfg | grep -i svcename
If you need to update the setting of SVCENAME, enter the following command:
db2 update dbm cfg using svcename <connection service name>
where <connection service name> is case-sensitive and must match the name of the service port that you placed in /etc/services (for example, db2 update dbm cfg using svcename db2c_db2inst1).
The update of the database manager configuration will not be effective until the next db2start command is issued. We will do this in step 7.
db2 catalog tcpip node <nodename> remote <host name> server <connection service name>
where,
To verify that the catalog command worked properly, issue the following command:
db2 list node directory
A sample output of this command is (blank lines have been removed for legibility):
Node Directory Number of entries in the directory = 1 Node 1 entry: Node name = MYNODE Comment = Protocol = TCPIP Hostname = 127.0.0.1 Service name = db2c_db2inst1
for example,db2 catalog db WAS as WASLOOP db2 uncatalog db WAS db2 catalog db WASLOOP as WAS at node MYNODE
Notes®:
Sample output for steps 5a to 5c
Before step 5a, a local database named WAS has already been created. The command db2 list db directory has output similar to the following message:
System Database Directory Number of entries in the directory = 1 Database 1 entry: Database alias = WAS Database name = WAS Local database directory = /home/ctsui Database release level = 9.00 Comment = Directory entry type = Indirect Catalog node number = 0
After step 5a, db2 list db directory has output similar to the following message:
System Database Directory Number of entries in the directory = 2 Database 1 entry: Database alias = WAS Database name = WAS Local database directory = /home/ctsui Database release level = 9.00 Comment = Directory entry type = Indirect Catalog node number = 0 Database 2 entry: Database alias = WASLOOP Database name = WAS Local database directory = /home/ctsui Database release level = 9.00 Comment = Directory entry type = Indirect Catalog node number = 0
After step 5b, db2 list db directory has output similar to the following message:
System Database Directory Number of entries in the directory = 1 Database 1 entry: Database alias = WASLOOP Database name = WAS Local database directory = /home/ctsui Database release level = 9.00 Comment = Directory entry type = Indirect Catalog node number = 0
After step 5c, db2 list db directory has output similar to the following message:
System Database Directory Number of entries in the directory = 2 Database 1 entry: Database alias = WAS Database name = WASLOOP Node name = MYNODE Database release level = 9.00 Comment = Directory entry type = Remote Catalog node number = -1 Database 2 entry: Database alias = WASLOOP Database name = WAS Local database directory = /home/ctsui Database release level = 9.00 Comment = Directory entry type = Indirect Catalog node number = 0
To verify that the catalog db command worked properly, issue the following two commands (and see the following sample output):
db2 connect to wasloop db2 connect to was
where db2 connect to wasloop will print the connection information and db2 connect to was will give you SQL1403N.
Sample output of db2 connect to wasloop:
Database Connection Information System Database Directory Database server = DB2/6000 6.1.0 SQL authorization ID = CTSUI Local database alias = WASLOOP
Sample output of db2 connect to was:
Database Connection Information System Database Directory Database server = DB2/6000 6.1.0 SQL authorization ID = CTSUI Local database alias = WAS
db2 update dbm cfg using authentication client
To verify that the command worked properly, display the new setting with the following command:
db2 get dbm cfg
Sample output:
.... Database manager authentication (AUTHENTICATION) = CLIENT ....
db2stop db2start
Note: You might need to use db2stop force to close all active database connections.
for example,db2 attach to MYNODE user myid using mypasswd db2 drop db WAS