OLE DB Error and Field not found problems

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Kire
Posts: 19
Joined: Thu 26 Jul 2012 09:07

OLE DB Error and Field not found problems

Post by Kire » Thu 01 Aug 2013 10:33

We have one customer where we have strange problems with the database connection.

After a while we do get an 'OLE DB error occured. Code 80040E21h', this happens while posting a record in a table.

Instead of this problem we also get a message that a field is not found: 'Field BAS_SYSNR not found'. It is not always the same field and not the same table. Checked the structures of the databse at the customer and it seems perfectly correct.

Yet we cannot reproduce these problems on our own pc.

Hope someone can point me in the right direction.

Regards,
Erik

AndreyZ

Re: OLE DB Error and Field not found problems

Post by AndreyZ » Fri 02 Aug 2013 09:29

OLE DB error occured. Code 80040E21h
This problem may be caused by the particular SQL Server client version your customer uses. Please make sure your customer uses the same SQL Server client (Native Client 11, Native Client 10, Native Client 9, OLEDB) version as you do.
Field BAS_SYSNR not found
This message means that there is no such field either on the server or on the client.

In order to give a more valid answer, we need the test project that demonstrates these problems. If you are able to create such project and send it to us, we will gladly investigate it.

Kire
Posts: 19
Joined: Thu 26 Jul 2012 09:07

Re: OLE DB Error and Field not found problems

Post by Kire » Tue 06 Aug 2013 10:25

Some more investigation showed that we probably have a thread issue that never caused problems (or at least never came to the surface) in the BDE version and is now giving problems using SDAC.

The point is we have a webservice in the application that uses the THTTPRIO class. The database layer (TMSTable etc) is openend in the main thread, however the calls getting in from the webservice are in their own thread. I suppose accessing the database layer from that thread directly is prohibited? And doing that might result in different errors like the ones mentioned?

Now I'm looking for an easy way to sync these threads regarding the database calls?

I hope you can confirm my suspicion regarding the threads and hopefully some ideas to fix this.

Regards,
Erik

AndreyZ

Re: OLE DB Error and Field not found problems

Post by AndreyZ » Wed 07 Aug 2013 06:48

SDAC is thread-safe, but the restriction is that you cannot use one connection (the TMSConnection component) in several threads, you must have connections in each thread. Please check that you have connection in each thread.

Kire
Posts: 19
Joined: Thu 26 Jul 2012 09:07

Re: OLE DB Error and Field not found problems

Post by Kire » Wed 07 Aug 2013 07:12

Ah, ok.

I already changed part of the code so that the call from the webservice is synchronized with the main thread and all problems seem to be gone now. I guess the original code was in fact also not quite 100% ok for BDE but seemed to be causing no real problems there.

Funny how one find development mistakes after all these years by switching to different components :mrgreen:

Thanx for the help !

Regards,
Erik

AndreyZ

Re: OLE DB Error and Field not found problems

Post by AndreyZ » Wed 07 Aug 2013 07:35

I am glad I could help. Feel free to contact us if you have any further questions about SDAC.

Post Reply