by Vikram Khatri | Jul 7, 2008
This logging framework works on Linux/Unix platforms only at this moment. I am looking for help who can port or rewrite this on Windows. If you are interested, please send me mail at vikram@zinox.com
by Vikram Khatri | Jul 7, 2008
Verify that the file system containing the splog directory is not full.
by Vikram Khatri | Jul 7, 2008
The logging framework is designed to debug the stored procedures, and the hardw method is used to debug these logging routines.
by Vikram Khatri | Jul 7, 2008
This is the most common issue. Look for your log file in the /tmp directory. This is related to the fenced user ID and file permissions on the ~/sqllib/splog directory. Ask your DBA to create a splog directory in ~/sqllib and grant full permissions on this splog...
by Vikram Khatri | Jul 7, 2008
This is the shared memory location used by the splogger library. When you stop DB2, it will free up shared memory used by DB2. For the splogger shared library, there is no way to determine when to free up this shared memory. You can use this number to free up the...
by Vikram Khatri | Jul 7, 2008
Set the DB2 instance-level parameter KEEPFENCED=YES using the CLP command UPDATE DBM CFG USING KEEPFENCED YES. After restarting the instance, the external stored procedures library will be loaded in memory by DB2 on first invocation of the stored procedure. These...
by Vikram Khatri | Jul 7, 2008
This is a normal result from spcat. It uses the DROP PROCEDURE command on the DB2 logging stored procedures, and if they do not yet exist in the database, you will see the error message above. The next time you run spcat, you will not get the error.
by Vikram Khatri | Jul 7, 2008
The bld script is used to compile splogger as a stand-alone program instead of a shared library, for testing. It makes a splog binary file, which you can use to execute the main program in splogger.sqc.
by Vikram Khatri | Jul 7, 2008
Modify the makefile and specify values for ALIAS, UID, and PWD. Put a CONNECT statement in spcat and spalter.
by Vikram Khatri | Jul 7, 2008
There is no connect statement in spcat, as it assumes the implicit connection to the database. How to use the implicit connection? $ db2set DB2DBDFT= $ db2stop force $ db2start $ db2 activate db
by Vikram Khatri | Jul 7, 2008
The file permissions on bldrtn might have changed, depending on how you copied the files to your system. Try changing the file permissions for bldrtn, embprep, and spcat using the chmod command. For example: $ chmod +x embprep bldrtn spcat bld spalter
by Vikram Khatri | Jul 7, 2008
Here is a list of common questions and answers that people have asked me while learning or maintaining the framework.
by Vikram Khatri | Jul 7, 2008
The logging framework routines are written in C, so you can use them directly from your C stored procedures without having to make a call to the logging stored procedures. The example C stored procedure below uses the logging API. To use the logging methods, include...
by Vikram Khatri | Jul 7, 2008
After you run make successfully, you will notice a file generated known as testsp.sql. The only reason we generate this file instead of giving this file as it is is to calculate the size of logging handle properly for your Linux/Unix platforms. This is due to the fact...
by Vikram Khatri | Jul 7, 2008
In order for you to set up the logging framework, you might need help from your system and/or database administrator to set up the stored procedure logging directory. Before we delve into this, let us understand how external stored procedures (Our logging framework...
by Vikram Khatri | Jul 7, 2008
An explanation of logging tokens The first DB2.OPEN_LOG call builds a linked list hash table as shown below from the logging tokens kept in the shared memory. For each logging token read from the shared memory or configuration file on its first invocation, OPEN_LOG...
by Vikram Khatri | Jul 7, 2008
Motivation You might need to write informational, error, and debug messages to a log file for a number of reasons: To test, analyze and validate business logic. To track and review detailed error messages. To fix business logic bugs encountered in production...
by Vikram Khatri | Jul 7, 2008
I published an article Log stored procedures messages for DB2 on Linux or Unix on IBM Developerworks website in January 2006. Since then, I have made several bug fixes and enhancements to this logging framework. The enhanced logging framework is documented here with...
by Vikram Khatri | Jun 24, 2008
If you are migrating your ODBC related code from one database to DB2, you might run into an issue of single quote vs. double quote issue. For example: Your ODBC code might issue a call to a Stored Procedure using double quote as shown below: CALL...
by Vikram Khatri | Jun 12, 2008
Sometimes, it may be necessary to expose data in your flat file with the relational data. There might be some situations where there is no option to load that data in a table. But still, you need a way to use this flat file data in your SQL statements. DB2 provides...