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:
- 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.
- 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.
- 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.
- 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.