Monday, February 14, 2011

Valentine's Day: How to date with DB2...

Today is Valentine's Day and according to Wikipedia an annual commemoration to "celebrating love and affection between intimate companions". This sounds like the typical DBA and database system relationship to me. What fits better on this day than looking into some of the data functionality DB2 has to offer.

Everybody should know who you are dating with. In case you don't know, here is an example to know more about your current date:

values(current date)

1                 
----------
14/02/2011


To find out what was going on yesterday, the following might come in handy:
values(current date - 1 day)

1                 
----------
13/02/2011


Many people wonder whether they and their date will match up. I always know when looking at the "date compatibility".

get db cfg
...
Date compatibility                                      = OFF
...

Well, this doesn't look too promising, but I know a way around. I can set the DB2_COMPATIBILITY_VECTOR and then look try again (requires instance restart and new database - this is life!).

get db cfg

...
Date compatibility                                      = ON
...


This looks much better and promising and I am sure that my (so far Oracle-based) application and DB2 are the perfect match. And because of the right financial details (licensing, maintenance, HR costs, ...) and properties like automatic maintenance (who would like that one in a household?), compression (are the cabinets and the attic crammed?), and performance they seem to move towards the "happily ever after" ending....