Unable to connect to IBM DB2 with Azure DataFactory Linked service

veerabhadra reddy kovvuri 181 Reputation points
2023-08-07T16:36:23.4966667+00:00

Port 22 , 23 , 449 , 8471 , 8476 , 9471, 9476 are whitelisted from ADF SHIR VM to the DB2 server/database (AS400), telnet to these ports are also successful. However, when we are testing the DB2 linked service wit userID and password, we are getting below error.

Could not load file or assembly 'file:///C:\Program Files\Microsoft OLE DB Provider for DB2\System\Microsoft.ApplicationInsights.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

We have place the Microsoft.ApplicationInsights.dll manually in the location shown in the error, however we are getting below error again. Can anyone just what else is required to make a connection to DB2 server using DB2 linked service ?

The type initializer for 'Microsoft.HostIntegration.Common.TelemetryClient' threw an exception.
Could not load file or assembly 'file:///C:\Program Files\Microsoft OLE DB Provider for DB2\System\Microsoft.ApplicationInsights.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,371 questions
{count} votes

Accepted answer
  1. KranthiPakala-MSFT 46,622 Reputation points Microsoft Employee
    2023-08-08T21:42:56.5633333+00:00

    @veerabhadra reddy kovvuri Welcome to Microsoft Q&A forum and thanks for reaching out here.

    From both the error messages, my understanding is that somehow dependent DLL i.e. Microsoft.ApplicationInsights.dll is missing from installation OLEDB provider installation path : C:\Program Files\Microsoft OLE DB Provider for DB2\System

    Did you already have OLEDB driver installed on the same SHIR VM or machine before installing Integrated runtime? ADF DB2 connector is built on top of Microsoft OLE DB Provider for DB2. SHIR Installation copies all DLLs include dependencies during installation of Integration runtime. If you already have OLEDB driver on the VM where SHIR is installed, then dependent DLL required by ADF won't be copied. Which can result in such errors.

    Resolution Step 1:

    In case if you already had OLEDB driver, then uninstall it as well as the Self hosted Integration runtime and then reinstall only the Self Hosted Integration runtime VM which should add the dependent libraries to respective folders and avoid such issues.

    Resolution Step 1: In case if the above step 1 didn't work, then please validate step 2 and see if that helps.

    Steps to get DLL :

    1. Go to nuget package portal : https://www.nuget.org/packages/Microsoft.ApplicationInsights
    2. Download package Microsoft.ApplicationInsights
    3. Change extension to zip
    4. Extract package
    5. DLL Microsoft.ApplicationInsights.dll should be present in library : microsoft.applicationinsights.2.17.0\lib\net46
    6. Copy this DLL to library : C:\Program Files\Microsoft OLE DB Provider for DB2\System and try again.

    To make sure it is not related to any other installations on the SHIR VM, you can also try to use a dedicated Azure VM for your SHIR and then try whitelisting the required ports. If that helps to connect successfully, then it confirms that there is something else that was installed in your earlier machine or VM in which SHIR was installed which is causing the issue.

    Hope this info helps. Do let us know how it goes.

    Thank you


    Please don’t forget to Accept Answer and Yes for "was this answer helpful" wherever the information provided helps you, this can be beneficial to other community members.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.