IBM Support

JDBC Connector with MongoDB database

Product Documentation


Abstract

JDBC Connector has been certified to connect to MongoDB Database. To use this Connectivity, the latest Datadirect JDBC MongoDB driver must be used (ISmongodb.jar)

As MongoDB is a NoSQL database, the user needs to define or correctly map the fields with the correct data type so that JDBC Connector can operator on those fields with the metadata specified. In order to automate this process, DataDirect has come up with a tool called schematool which samples the collections in the MongoDB database and maps the fields to the most reasonable data type.

Content

Configuring the JDBC Driver Configuration File for MongoDB database

The file "isjdbc.config" is the configuration file which is used for the JDBC connector. This file is available or needs to be created if not already present at the location "<IS-Server-Installation>/Server/DSEngine"

The following entries need to be added (or appended to the already existing entries ) to the file
CLASSPATH=<IS-Server-Installation>/ASBNode/lib/java/ISmongodb.jar:$CLASSPATH
CLASS_NAMES=com.ibm.isf.jdbc.mongodb.MongoDBDriver

CLASSPATH specifies the location of the JDBC Driver for MongoDB database. CLASS_NAMES specifies the class file that needs to be loaded by the JDBC Connector for connecting to the Database

URLs to be used for connecting to MongoDB using the JDBC Connector by Datadirect JDBC MongoDB drivers

When the application is reading the data, the following properties need to be specified
jdbc:ibm:mongodb://<MongoDBServer>:<PortNo>;DatabaseName=<DatabaseName>;SchemaMap=<SchemaMap name>
for example
jdbc:ibm:mongodb://<MongoDBServer>:27017;DatabaseName=testdb;SchemaMap=/tmp/SchemaMaps/testMongoDB/schema.config

When the application is writing the data, the following properties need to be specified
jdbc:ibm:mongodb://<MongoDBServer>:<PortNo>;DatabaseName=<DatabaseName>;ReadOnly=false
for example
jdbc:ibm:mongodb://<MongoDBServer>:27017;DatabaseName=testdb;ReadOnly=false

Additional details on the connection options of the driver can be found in Progress DataDirect for JDBC for MongoDB  Connection Property Descriptions Page

Important Note
The entry “REFRESH MAP” needs to be added to the 'Before SQL Statement' job property, to be used when the tables are created in the KeySpace, once the SchemaMap has been created.

The user executing the job should have the permissions on the directory containing the config files for SchemaMap
 

Document information

More support for: InfoSphere Information Server

Component: JDBC Connector

Software version: 11.5, 11.7

Operating system(s): AIX, Linux, Windows

Reference #: 0720131

Modified date: 06 September 2018