How to connect to MongoDB from DataStage using ODBC

Table of Contents

Here are the steps to connect to the MongoDB database from DataStage using the ODBC connector. These steps were tested on a DataStage server running on Windows. You need to have your

Mongo DB Server

  • MongoDB mongod process up and running. mongod is the primary daemon process for the MongoDB system. It handles data requests, manages data access, and performs background management operations

  • MongoDB BI Connector mongosqld process up and running. mongosqld accepts incoming requests from a SQL client and proxies those requests to a mongod. mongosqld needs to start with the addr option if you need mongosqld to wait for connection at multiple addresses

Example: "mongosqld.exe" --addr ",localhost"

These are the prerequisites and will be taken care by your MongoDB admin.

DataStage Server

Below mentioned steps need to be followed for DataStage server configuration

  • Step 01: Download and install the “MongoDB ODBC Driver for BI Connector” from As of today September 29, 2018 MongoDB ODBC driver is available for Windows, Ubuntu 14.04, Ubuntu 16.04 and RHEL 7 DataStage server platform. Choose the correct version\bit for your operating system

  • Step 02: Create an ODBC connection. This ODBC entry needs to be added in system DSN (Image 02) and the driver should be Unicode Driver (Image 03). For LINUX\AIX environments ODBC connection entry needs to be created in odbc.ini.

  • Step 03: Test the ODBC connection from Windows and make sure it’s working.  

  • Step 04: Edit the “uvodbc” of your project to add the entry at the bottom for this newly created ODBC connection.This is applicable for DataStage servers running on Windows only. Here is how this entry will look like


  • Step 05: Test the ODBC connection from DataStage and make sure its working by trying a table definition import. If the connection is successful you will be able to see the table definition (Image 03)  

  • Step 06: Create the DataStage job with ODBC stage to connect to the MongoDB and run the same. I had to disable the AUTOCOMMIT in the ODBC stage for the job to run fine

  • Step 07: Validate the results as applicable

Hope this is helpful information to make a MongoDB connection from DataStage.

Share this blog:

Related Articles