Unexpected Exception when inserting data in SQL 2000
- From: andrew.elmhorst@xxxxxxxxx
- Date: 11 Apr 2006 07:49:43 -0700
Our application has run for years using the SQL 2000 JDBC and the jTDS
driver. I recently tried using the SQL 2005 driver, and I'm getting
unexpected behavior. Here is the scenario...
We have code that inserts data into an SQL table that has a primary key
constraint on one of the columns being inserted. At times, the code
will insert a row that violates the primary key constraint. This is an
expected behavior, and we catch the exception and check for the error
code of 2627, which tells us that this is the case. The code is using a
prepared statement, which is re-used for each insert call.
The SQL 2005 is giving us the exception as expected. However, later on,
it keeps throwing the exception when it shouldn't be. The same
preparedstatement is set with different values, which are unique and
not already in the database table. The PreparedStatement.execute() call
is throwing an SQLException with an error code of 2627. I've examined
the preparedstatement in the debugger, and it's parameter values are
unique. I've tried profiling the call, and I don't even see the
statement hitting the database.
What is going on? Has anyone else seen this?
Andrew Elmhorst
.
- Follow-Ups:
- Re: Unexpected Exception when inserting data in SQL 2000
- From: Joe Weinstein
- Re: Unexpected Exception when inserting data in SQL 2000
- Prev by Date: RE: MSDE connection problem (port???)
- Next by Date: Re: Escape character weirdness
- Previous by thread: Escape character weirdness
- Next by thread: Re: Unexpected Exception when inserting data in SQL 2000
- Index(es):
Relevant Pages
|