Azure Function connecting on-prem using ODBC Db2 using VNet Gateway

Suraj Revankar 11 Reputation points
2024-06-20T16:52:41.1633333+00:00

Hi All,

I am trying to connect Azure function to my on-prem Db2 system via ODBC Connection by using VNET method.

When i test this locally i am able to run it successfully. However when i publish it to the cloud azure function and run. i get the below error.

I have added the system DSN on the On-prem Machine and also the gateway is installed.

ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,516 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Dennis Zebregs 0 Reputation points
    2024-06-20T17:41:17.68+00:00

    The error message you are encountering, ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, indicates that your Azure Function is unable to locate the ODBC data source name (DSN) or the necessary driver to connect to your on-prem DB2 system. Here are some steps you can take to troubleshoot and resolve this issue:

    1. Verify DSN Configuration on Azure

    Make sure the DSN configuration on Azure is identical to your local setup. This includes:

    • The exact name of the DSN.
    • The DSN should be configured in the same way (system DSN or user DSN).
    • The ODBC driver must be installed on the Azure environment.
    1. Check VNET Integration

    Ensure your Azure Function is properly configured to connect to your on-premises network via VNET integration. This involves:

    • Configuring a VNET in Azure that connects to your on-premises network.
    • Ensuring the Azure Function is integrated with this VNET.
    • Confirming that the VNET configuration allows the Azure Function to reach the on-premises DB2 system.
    1. Install ODBC Driver on Azure Function App

    Ensure the appropriate ODBC driver for DB2 is installed and accessible by the Azure Function. If the driver is not installed, you'll need to include it in your Azure Function deployment. This typically involves:

    • Adding the driver installation script or binaries to your Azure Function's deployment package.
    • Running the installation script as part of the function app start-up.
    1. Environment Variables

    Set the necessary environment variables for your Azure Function to use the DSN. This includes setting the ODBCSYSINI and ODBCINI environment variables to point to the correct ODBC configuration files.