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

Suraj Revankar 11 Reputation points

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,643 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Dennis Zebregs 0 Reputation points

    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.

  2. Pinaki Ghatak 3,110 Reputation points Microsoft Employee

    Hello @Suraj Revankar

    It seems like the error is related to the ODBC driver not being found.

    Have you installed the ODBC driver on the Azure Function App?

    You may need to install the ODBC driver on the Azure Function App to be able to connect to your on-premises Db2 system. Also, have you checked if the connection string is correct?

    Make sure that the connection string is pointing to the correct DSN name that you have created on the on-premises machine. If you have already installed the ODBC driver and checked the connection string, then it could be a permission issue.

    Make sure that the Azure Function App has the necessary permissions to access the on-premises Db2 system. If you are still facing issues, please provide more information about your setup and the steps you have taken so far.

    0 comments No comments