Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / November 2006

Tip: Looking for answers? Try searching our database.

Oracle 10 + Sun App Server 7: Unique Constraint Violation?!?

Thread view: 
ndamianov - 15 Nov 2006 08:27 GMT
Hi All,

For about a week and a half I have been trying to solve a mysterious
issue with unique constraint violations on our database server without
any luck.

We basically have a simple table with a unique primary key (number) and
a few string columns that aren't part of the key.

With J2EE on the Sun App Server 7, we always make sure we get the
nextval from the table's sequence before inserting it into the table. I
have checked this numerous times.

The Oracle DB doesn't have any triggers or other procedures accessing
the table in any way.

>From time to time, we get a bunch of unique constraint key violations
in spaces of about 30 minutes after which its all good again...

Has anybody heard of this issue or know how to fix it?

Regards,

Nikk
joeNOSPAM@BEA.com - 15 Nov 2006 16:40 GMT
> Hi All,
>
[quoted text clipped - 19 lines]
>
> Nikk

Hi. It sounds like a thread safety issue. If multiple threads all ask
the DBMS what the
nextval is, and get the same value, and then all try to send back a new
row with that
value, you'll get your problem. You could run an experiment where you
add a string
column, and inert the appserver's java thread ID and timestamp.
Whenever your
app gets the unique key violation, query the row for what thread beat
you to it, and
when.

Joe Weinstein at BEA Systems


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.