by Vikram Khatri | May 20, 2007
DB2 provides a tool db2dclgn that you can use effectively as an aid in your C/C++ or Java coding efforts. The example shown here is for embedded SQL in C. Create a table for demo CREATE TABLE “EXE”.”CUTION” ( “UT_UD” BIGINT NOT NULL...
by Vikram Khatri | May 18, 2007
Did you ever know how powerful MERGE is in DB2? Let me demonstrate that to you through this simple example. Create a table $ db2 connect to sample $ db2 “create table fmtmerge (c1 int not null generated always as identity primary key, c2 decimal(13,4) not null,...
by Vikram Khatri | May 17, 2007
The following program is an example of CLI and embedded SQL statements in the same C program to perform array inserts to achieve high performance. Why do you need to use a mixture of CLI and embedded SQL program? Sometimes, it is desirable from the coding perspective...
by Vikram Khatri | May 16, 2007
Say for an example, you want to increment a column whenever a user logs in using an application for audit purpose. Normally in a single unit of work, DB2 will guarantee the data and there will not be an issue of concurrency if you use an INSERT and do an UPDATE upon...
by Vikram Khatri | May 16, 2007
If you are writing embedded SQL application using C/C++ or SQLJ application using Java, you will come across an issue about how to use DB2 PREPARE statement effectively in your application code. When I talk to Oracle or SQL Server DBA, they all seem to have an...
by Vikram Khatri | May 16, 2007
The concept of packages in DB2 conflicts with the package understanding that comes with an Oracle DBA who is expanding his/her horizon to include DB2 as an added skill-set. Please refer to this excellent article...
by Vikram Khatri | Apr 13, 2007
When you use embedded SQL in your C/C++ code, you first run PREP command to process all EXEC SQL statements in your source. The PREP step happens before C/C++ compiler is able to invoke its preprocessor that will include header files, expand trigraph and replace...
by Vikram Khatri | Mar 14, 2007
I am trying to install Tomcat to test DB2 web services and I ran into several problems on my Fedora Core 5 server to start the Tomcat server. This is how I solved this. I found this problem widely reported but very few instructions to solve the problem. Install...
by Vikram Khatri | Mar 13, 2007
If you are migrating other database data to db2 and encounter a timestamp like 2007-03-07 19:30:00+05, you will need to adjust the timestamp correctly if you are in a different time zone. I used this Java function to massage the timestamp properly so that I get the...
by Vikram Khatri | Mar 6, 2007
If you are trying to install a jar file using sqlj.install_jar command and getting SQL4302N error, you may follow these steps to fix this problem. These may not work exactly in the same manner for you but it will give you some insight as how to fix this issue. This...
by Vikram Khatri | Mar 6, 2007
When you create a DB2 instance in Unix, you have the option of specifying a fenced user-id different than instance owner. The purpose of fenced user id is to protect DB2 from untested or malicious code from the external stored procedures, user defined functions etc....
by Vikram Khatri | Mar 2, 2007
When you need to load the data on DB2 server and the data files reside somewhere else, you need to FTP or copy them to the server. You can take help from a sample Perl driver program provided in your sqllib/samples/autoloader/loadFtpFtc.pl.
by Vikram Khatri | Mar 2, 2007
Normally, you would run the DB2 LOAD on the DB2 server. But, when you try to run DB2 LOAD from a client, you need to take care of few things. A sample DB2 LOAD script that runs well on Server. SET CURRENT SCHEMA=”ADMIN”; LOAD FROM...
by Vikram Khatri | Feb 15, 2007
If you are planning to use PHP with DB2 Express-C on Linux, you will need PHP extension for the DB2. The same extension will also work for IBM Cloudscape or Apache Derby databases. [Note: The instructions here are for the Redhat Linux and you will need slight...
by Vikram Khatri | Feb 15, 2007
Few things have changed in DB2 9. For example, IBM does not use RPM to install the software any more on Linux platforms. This change might upset many who rely upon rpm-qa to query about DB2 software. If some one has installed DB2 9 for you on Linux, how would know the...
by Vikram Khatri | Feb 12, 2007
1. How to implement Java UDF using CLOB for DB2GENERAL parameter passing? When you use DB2GENERAL parameter passing in the declaration of the SQL UDF, DB2 will use the legacy driver to map the data types between Java and DB2. If you need to pass CLOB as a parameter in...
by Vikram Khatri | Feb 2, 2007
This is How I did: Eclipse, PHP and DB2 on Windows Platform After working in Microsoft .Net technologies for few years, I made up my mind to explore PHP world. In fact, this site is hosted using Drupal framework which is in PHP and I did not know anything about PHP to...
by Vikram Khatri | Feb 1, 2007
Did you know that you can run DB2 REORGCHK command to update the statistics on the tables? Normally, you would run RUNSTATS command against each table to update the statistics. Consider using REORGCHK as shown below: To update all the user and system tables use:...
by Vikram Khatri | Nov 21, 2006
Victor Chang and others have published a white paper on row compression on DB2 9. At a high level, authors have achieved significantly better performance running DSS queries in a compressed database using only half as many disks as the uncompressed database. They have...
by Vikram Khatri | Nov 21, 2006
David Sciaraffa explains that DB2 9 uses autonomic algorithm to determine the number of prefetchers (IO_SERVERS) and page-cleaners (IO_CLEANERS) to determine the optimum values and they are described here: Prefetchers: IO_SERVERS Page Cleaners: IO_CLEANERS...