How to connect to MongoDB from DataStage using ODBC

Sunday, September 30, 2018

How to connect to MongoDB from DataStage using ODBC


Here are the steps to connect to MongoDB database from DataStage using ODBC connector. These steps were tested on DataStage server running on Windows. You need to have your
  • 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 started with addr option if you need mongosqld wait for connection at multiple address.
          Example: "mongosqld.exe" --addr "192.168.40.1,localhost"

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

Below mentioned steps need to be followed for DataStage server configuration

Step 01: Download and install the "MongoDB ODBC Driver for BI Connector" from https://github.com/mongodb/mongo-odbc-driver/releases/. As of today September 29, 2018 MongoDB ODBC driver is avaliable for Windows, Ubuntu 14.04, Ubuntu 16.04 and RHEL 7 DataStage server platform. Chose the correct version\bit for your operating system.
Step 02: Create 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 its 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.

DBMSTYPE = ODBC

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 ODBC stage for the job to run fine.
Step 07: Validate the results as applicable.


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

No comments

Post a Comment

Error 404

The page you were looking for, could not be found. You may have typed the address incorrectly or you may have used an outdated link.

Go to Homepage