Record Count randomly 0 instead of 1

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
martin
Posts: 52
Joined: Mon 07 Nov 2005 09:48

Record Count randomly 0 instead of 1

Post by martin » Wed 16 Jun 2010 12:58

We have the problem, that a very simple point query ("select blobfield from table where id = 12345") does fail once in a while, say every other day. When Inserting a row then instead of updating, the server returns a key violation.

It returns 0 as record count altough a record with that key is existing in the table. After destroying and recreating the query object, the problem disappears, the query correctly returns 1 row.

Is this some kind of caching problem ? Or a bug in SQL Server 2008 Enterprise ?

We cannot provide you with a small sample because the table has 15 Mio rows.

Any ideas what we could do ?

Regards
Martin

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Re: Record Count randomly 0 instead of 1

Post by Dimon » Thu 17 Jun 2010 10:02

martin wrote:When Inserting a row then instead of updating, the server returns a key violation.
Please make sure that the table has autoincrement (IDENTITY) field.
martin wrote:It returns 0 as record count altough a record with that key is existing in the table. After destroying and recreating the query object, the problem disappears, the query correctly returns 1 row.
Please, specify exact steps to reproduce the problem.

martin
Posts: 52
Joined: Mon 07 Nov 2005 09:48

Re: Record Count randomly 0 instead of 1

Post by martin » Thu 17 Jun 2010 12:46

Dimon wrote:
martin wrote:When Inserting a row then instead of updating, the server returns a key violation.
Please make sure that the table has autoincrement (IDENTITY) field.
Why would we need an identitiy field ? :roll:

We want to INSERT a new row when the data for a specific primary key is not yet there but UPDATE it with new data, when some of the data for a specific primary key is already there.

We have the PROBLEM, that a simple SELECT * FROM TABLE WHERE KEY = XY returns NO ROW from time to time, altough you can see in SQL Management Studio, that there is actually a row for this query. After destroying and recreating the query object, the very same SELECT correctly returns a row without any change on the database.

Sorry, but this is really driving us mad. When we cannot assume that a query always returns a row when there actually is a row in the database, this is a KILLER BUG !!!

Again, I don't say this is a bug in your driver, but there is a bug and I would be very happy if you could help us to locate where the problem is asap.
Dimon wrote:Please, specify exact steps to reproduce the problem.
As I said, unfortunately we cannot provide simple step-by-step instructions. The database is huge and so is the incoming traffic. Problem only appears from time to time. We really need another way to find the bug. Do you have some tools or a special build we could use to find the problem ?

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Fri 18 Jun 2010 08:35

Try to use standard dbExpress drivers supplied by Borland and check if the problem still persist.

martin
Posts: 52
Joined: Mon 07 Nov 2005 09:48

Post by martin » Tue 22 Jun 2010 08:26

Are these drivers supplied with Delphi 6 ? Can I use them together with TQRSQLConnection ?

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 22 Jun 2010 15:10

Unfortunately, support of standard dbExpress driver to connect to SQL Server begins from RAD Studio 2007.
But to help you, we need more information about this problem.

martin
Posts: 52
Joined: Mon 07 Nov 2005 09:48

Post by martin » Wed 07 Jul 2010 14:19

We can close this issue :D

Client Operator has setup two loader apps to populate the same server instead of two different servers so simultanous inserts have been performed which caused the primary key violations :evil:

So no bug in the driver, of course 8)

Thanks for support.

Post Reply