OLE DB error occurred. Code 80004005h

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
alt.ua
Posts: 15
Joined: Tue 08 Oct 2019 09:24

OLE DB error occurred. Code 80004005h

Post by alt.ua » Thu 02 Jul 2020 09:23

Hello,

UniDAC 8.2.5
Delphi 10.2 Version 25.0.31059.3231
Microsoft SQL Server 2017 (RTM-CU20) (KB4541283) - 14.0.3294.2 (X64) on Windows Server 2016 Standard 10.0 <X64> (Build 14393: ) (Hypervisor)

Code: Select all

SELECT COUNT( ID ) FROM SomeTable WHERE <Condition>
UniQuery sometime crashes with exception EUniError # ErrorCode:-2147467259 # OLE DB error occurred. Code 80004005h
Query executed in separate thread
One UniConnection and one UniQuery objects per each thread
CoInitializeEx(Nil, COINIT_MULTITHREADED) is used

Code: Select all

  FConnDB := TUniConnection.Create( Nil );
  FConnDB.ProviderName := 'SQL Server';
  FConnDB.SpecificOptions.Add( 'SQL Server.Provider=prNativeClient' );
  FConnDB.SpecificOptions.Add( 'SQL Server.NativeClientVersion=nc2012' );
  FConnDB.LoginPrompt := False;
  FConnDB.AutoCommit := False;
  FConnDB.Server := <server_name>;
  FConnDB.Database := <database_name>;
  FConnDB.Username := <string_data>;
  FConnDB.Password := <string_data>;
How to obtaine native SQL Server error message for detect error reason?

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: OLE DB error occurred. Code 80004005h

Post by Stellar » Thu 02 Jul 2020 10:15

Unfortunately, we can't reproduce the issue.
To investigate this behavior of UniDAC, please compose a small sample demonstrating the issue and send it to us, including database objects creating scripts.
You can send the sample using the contact form at our site: devart.com/company/contactform.html

alt.ua
Posts: 15
Joined: Tue 08 Oct 2019 09:24

Re: OLE DB error occurred. Code 80004005h

Post by alt.ua » Thu 02 Jul 2020 13:57

I can't make the sample because I don't know error reason and can't reproduce the exception

If I will know how to get the native SQL Server error message I will understand the reason and will be able to emulate this exception

alt.ua
Posts: 15
Joined: Tue 08 Oct 2019 09:24

Re: OLE DB error occurred. Code 80004005h

Post by alt.ua » Thu 02 Jul 2020 14:04

Tell me please, how I can obtaine native SQL Server error message from EUniError exception ?

for example: An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "The statement has been terminated.". An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "Violation of PRIMARY KEY constraint 'PK_SalesPerson_SalesPersonID'. Cannot insert duplicate key in object 'dbo.SalesPerson'."

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: OLE DB error occurred. Code 80004005h

Post by Stellar » Fri 03 Jul 2020 11:29

This error message is returned by MS Native Client, which we display to a user. Unfortunately, we cannot influence MS Native Client to return a more correct message. Please try to use Direct mode to get the correct error message, for example:

Code: Select all

UniConnection1.SpecificOptions.Values['Provider'] := 'prDirect';

alt.ua
Posts: 15
Joined: Tue 08 Oct 2019 09:24

Re: OLE DB error occurred. Code 80004005h

Post by alt.ua » Mon 06 Jul 2020 06:03

Do you mean

Code: Select all

FConnDB.SpecificOptions.Add( 'SQL Server.Provider=prDirect' );
?

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: OLE DB error occurred. Code 80004005h

Post by Stellar » Mon 06 Jul 2020 09:54

Yes. We've corrected the answer.

alt.ua
Posts: 15
Joined: Tue 08 Oct 2019 09:24

Re: OLE DB error occurred. Code 80004005h

Post by alt.ua » Wed 08 Jul 2020 06:43

Three days in a row an error does not occur.

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: OLE DB error occurred. Code 80004005h

Post by Stellar » Thu 09 Jul 2020 17:16

Did changing the provider to prDirect help?

alt.ua
Posts: 15
Joined: Tue 08 Oct 2019 09:24

Re: OLE DB error occurred. Code 80004005h

Post by alt.ua » Fri 10 Jul 2020 09:02

Yes, thanks

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: OLE DB error occurred. Code 80004005h

Post by Stellar » Fri 10 Jul 2020 10:07

Glad to see that the issue was resolved.
Feel free to contact us if you have any further questions about our products.

Post Reply