473,397 Members | 2,084 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Hepl please - Product stop to work on DB2 v9.1!

Hello.

Our product works fine on all 7.x and 8.x DB2 versions. But stops to
work on DB2 v9.1.

The main problem is - duplicate primary key (sqlcode=-803) happens when
inserting records in QUEUE table.
The primary key of QUEUE table is - 3 fields - QID CHAR(4), PRI INT
and QTIME TIMESTAMP.
When inserting records into QTIME table we are using the "CURRENT
TIMESTAMP" value for QTIME field.
And this is the root of problem. In DB2 v9.1 "CURRENT TIMESTAMP"
returns a lot of duplicated values(!) in contrast to previous versions
of DB2.

To solve DUP_KEY error we have added autoinremented field to the
primary key of QUEUE table and can see that all things starts to work
but there are too many duplicated TIMESTAMP values in QTIME field.
Looks like in DB2 v9.1 only first 3 digits are used in microseconds
fraction of timestamp.
Why this happens in new version of DB2? We see that in older DB2
versions all 6 digits were used in microseconds fraction in TIMESTAMP.

Is it a bug? Or "feature" of new DB2?
Should we wait for fixpack or think about workarounds?...

Could you please help?

WBR,
Dmitry.

Oct 31 '06 #1
5 2629
Have you opened a PMR with IBM support to find out whether it is a bug
or not?

Larry Edelstein

Dmitry Bond. wrote:
Hello.

Our product works fine on all 7.x and 8.x DB2 versions. But stops to
work on DB2 v9.1.

The main problem is - duplicate primary key (sqlcode=-803) happens when
inserting records in QUEUE table.
The primary key of QUEUE table is - 3 fields - QID CHAR(4), PRI INT
and QTIME TIMESTAMP.
When inserting records into QTIME table we are using the "CURRENT
TIMESTAMP" value for QTIME field.
And this is the root of problem. In DB2 v9.1 "CURRENT TIMESTAMP"
returns a lot of duplicated values(!) in contrast to previous versions
of DB2.

To solve DUP_KEY error we have added autoinremented field to the
primary key of QUEUE table and can see that all things starts to work
but there are too many duplicated TIMESTAMP values in QTIME field.
Looks like in DB2 v9.1 only first 3 digits are used in microseconds
fraction of timestamp.
Why this happens in new version of DB2? We see that in older DB2
versions all 6 digits were used in microseconds fraction in TIMESTAMP.

Is it a bug? Or "feature" of new DB2?
Should we wait for fixpack or think about workarounds?...

Could you please help?

WBR,
Dmitry.
Oct 31 '06 #2
Dmitry Bond. wrote:
Hello.

Our product works fine on all 7.x and 8.x DB2 versions. But stops to
work on DB2 v9.1.

The main problem is - duplicate primary key (sqlcode=-803) happens when
inserting records in QUEUE table.
The primary key of QUEUE table is - 3 fields - QID CHAR(4), PRI INT
and QTIME TIMESTAMP.
When inserting records into QTIME table we are using the "CURRENT
TIMESTAMP" value for QTIME field.
And this is the root of problem. In DB2 v9.1 "CURRENT TIMESTAMP"
returns a lot of duplicated values(!) in contrast to previous versions
of DB2.

To solve DUP_KEY error we have added autoinremented field to the
primary key of QUEUE table and can see that all things starts to work
but there are too many duplicated TIMESTAMP values in QTIME field.
Looks like in DB2 v9.1 only first 3 digits are used in microseconds
fraction of timestamp.
Why this happens in new version of DB2? We see that in older DB2
versions all 6 digits were used in microseconds fraction in TIMESTAMP.

Is it a bug? Or "feature" of new DB2?
Should we wait for fixpack or think about workarounds?...
The granularity of CURRENT TIMESTAMP is bounded by the system clock.
So if you only get 1/1000 of seconds that's where it's coming from.
There is no rule whatsoever that defined CURRENT TIMESTAMP to produce
unique values.
However pre-DB2 9 code internaly made different invocations of CURRENT
TIMESTAMP unique (which is where you saw the extra digits from.
As concurrency and CPU speeds increase this is causing serious latching
problems, hence the change.
So much for the background. Now for the solution:
TIMESTAMP(GENERATE_UNQIQUE()) will give a guaranteed unique timestamp
for every invocation even within a single SQL statements (good for mass
inserts)

So, no bug, it's working as designed.

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

WAIUG Conference
http://www.iiug.org/waiug/present/Fo...Forum2006.html
Oct 31 '06 #3
Serge Rielau wrote:
The granularity of CURRENT TIMESTAMP is bounded by the system clock.
So if you only get 1/1000 of seconds that's where it's coming from.
There is no rule whatsoever that defined CURRENT TIMESTAMP to produce
unique values.
However pre-DB2 9 code internaly made different invocations of CURRENT
TIMESTAMP unique (which is where you saw the extra digits from.
As concurrency and CPU speeds increase this is causing serious latching
problems, hence the change.
So much for the background. Now for the solution:
TIMESTAMP(GENERATE_UNQIQUE()) will give a guaranteed unique timestamp
for every invocation even within a single SQL statements (good for mass
inserts)

So, no bug, it's working as designed.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
For those of you (like me) who like to copy and paste, there is a
slight typo in the above syntax. It should be:

TIMESTAMP(GENERATE_UNIQUE())

Oct 31 '06 #4
We have:

db2 'describe values (timestamp(GENERATE_UNIQUE()))'

SQLDA Information

sqldaid : SQLDA sqldabc: 896 sqln: 20 sqld: 1

Column Information

sqltype sqllen sqlname.data
sqlname.length
-------------------- ------ ------------------------------
--------------
392 TIMESTAMP 26 1
1
So instead of:

create table t1 (c1 timestamp not null default current timestamp)

we will (now) try

create table t1 (c1 timestamp not null default values
(timestamp(GENERATE_UNIQUE()))

Fails (8.2 tested, manual of 9 does not differ in this).

So would it be possible to have a values construct in the default
clause? (understanding and accepting the non uniqueness of current
timestamp)

Bernard Dhooghe
Mark A wrote:
Serge Rielau wrote:
The granularity of CURRENT TIMESTAMP is bounded by the system clock.
So if you only get 1/1000 of seconds that's where it's coming from.
There is no rule whatsoever that defined CURRENT TIMESTAMP to produce
unique values.
However pre-DB2 9 code internaly made different invocations of CURRENT
TIMESTAMP unique (which is where you saw the extra digits from.
As concurrency and CPU speeds increase this is causing serious latching
problems, hence the change.
So much for the background. Now for the solution:
TIMESTAMP(GENERATE_UNQIQUE()) will give a guaranteed unique timestamp
for every invocation even within a single SQL statements (good for mass
inserts)

So, no bug, it's working as designed.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

For those of you (like me) who like to copy and paste, there is a
slight typo in the above syntax. It should be:

TIMESTAMP(GENERATE_UNIQUE())
Nov 2 '06 #5
If this were supported, which it isn't, it would be without the VALUES.
Use a BEFORE TRIGGER.

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

WAIUG Conference
http://www.iiug.org/waiug/present/Fo...Forum2006.html
Nov 3 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: gregory_may | last post by:
Is there a more econimical way to stop people from decompiling my .Net product? I dont have $1900 to spend on the .Net Decompiler Protector. Anyone have any thoughts/experiences with these or...
2
by: Claire Streb | last post by:
Dear Microsoft, You make some great products, really, but I have a request: Please stop taking away functionality from your users. 1) In Visual Studio 6, we had two output folders, Debug and...
11
by: Paul Aspinall | last post by:
Hi Can anyone offer any hints / tips for creating registration keys / application activation, as software copy protection measures for a Winform app developed in C#? Thanks
8
by: Andy Capon | last post by:
Hi There, We have a medium size project about 2000 source files and 700,000 lines of code, as you can imagine this takes some time to rebuild all. Now our problem is that we have a code...
9
by: Paulers | last post by:
Hello vb.net experts :) I am trying to program an app that resides in the system tray and I am trying to put all my main code in sub Main(). I am getting this errormessage at compile: ...
8
by: Dynamo | last post by:
Hi again, I am constructing a site on a small scale where people can buy nik naks and pay for them via paypal. Everything works fine unless there is only one of an item left for sale. What if 2...
2
by: Tyla | last post by:
I have been teaching myself javascript and i am having a huge problem with this form. All it has to do is check that every field has something in it and then post, but as soon as it gets to the...
8
by: Richard Maher | last post by:
Hi, I am in a mouseup event for button A and I'd like to disable=false button B before starting some work. Is there anyway that an event for button B can then fire before my event processing for...
1
by: theflyingminstrel | last post by:
Hi, I’m having some trouble with a Javascript code, and I was wondering if anyone can help: I am trying to build a price estimator that has multiple fields. I would like the first two fields to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.