You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Mark Tucker <tu...@us.ibm.com> on 2005/10/19 22:58:19 UTC

[Bug fix?] DB2 unique constraint violation detection

[I apologize if this is a duplicate message, I've been getting delivery 
failure reports...]

I have encountered a bug in OJB related to detecting unique constraint 
violations in DB2. This seems to work fine on Microsoft SQL Server and 
MySQL (I haven't tried other databases). The problem is that the check for 
the DB2 SQLSTATE code for unique constraint violation (23505) is only 
checked during insert, not during update.
 
Specifically, in JdbcAccessImpl (source from OJB 1.0.3, dated 
03-April-2005), executeInsert() specifically checks for the DB2 SQLSTATE 
(defined as SQL_STATE_FK_VIOLATED). However, executeUpdateSQL() and 
executeUpdate() only check for SQL_STATE_KEY_VIOLATED (23000).
 
I see in CVS that this has been fixed (by factoring new ExceptionHelper 
class). Will this fix be included in 1.0.4? If so, is there a planned 
release date for 1.0.4? If not, would it be possible to fix this in 1.0.4 
in JdbcAccessImpl directly by adding the check for SQL_STATE_FK_VIOLATED 
to executeUpdate() and executeUpdateSQL()?
 
Thanks
- Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: [Bug fix?] DB2 unique constraint violation detection

Posted by Armin Waibel <ar...@apache.org>.
Hi Mark,

Mark Tucker wrote:
> [I apologize if this is a duplicate message, I've been getting delivery 
> failure reports...]
> 
> I have encountered a bug in OJB related to detecting unique constraint 
> violations in DB2. This seems to work fine on Microsoft SQL Server and 
> MySQL (I haven't tried other databases). The problem is that the check for 
> the DB2 SQLSTATE code for unique constraint violation (23505) is only 
> checked during insert, not during update.
>  
> Specifically, in JdbcAccessImpl (source from OJB 1.0.3, dated 
> 03-April-2005), executeInsert() specifically checks for the DB2 SQLSTATE 
> (defined as SQL_STATE_FK_VIOLATED). However, executeUpdateSQL() and 
> executeUpdate() only check for SQL_STATE_KEY_VIOLATED (23000).
>  
> I see in CVS that this has been fixed (by factoring new ExceptionHelper 
> class). Will this fix be included in 1.0.4?

CVS HEAD is OJB 1.x development. But I can backport this helper class 
for 1.0.4.


> If so, is there a planned 
> release date for 1.0.4?

We plan to prepare a 1.0.4rc for end of this month (rc because we do 
much bug fixing and refactoring since 1.0.3).

regards,
Armin


> If not, would it be possible to fix this in 1.0.4 
> in JdbcAccessImpl directly by adding the check for SQL_STATE_FK_VIOLATED 
> to executeUpdate() and executeUpdateSQL()?
>  
> Thanks
> - Mark
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org