Skip to content
IBM DB2 Driver for the Django application Framework
Branch: master
Clone or download
Latest commit e3767b8 May 15, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
contributing DCO Sep 14, 2017
ibm_db_django removing white spaces Feb 25, 2019
CHANGES Django 2.0 Support Feb 27, 2018
LICENSE Backend support for IBM Dataservers in Django Framework. Jun 16, 2009 Added the contributing folder Apr 2, 2018 readme updated May 15, 2019 Updated release number to Nov 25, 2016

Getting started with IBM DB Django adapter

IBM DB2 support for the Django application Framework

ibm_db_django enables access to IBM DB2 from Django applications []

The adapter has been developed and is supported by IBM

Prerequisites for Django on Python

  • Python 2.5.
  • Django Framework 1.7.x or above.
  • IBM_DB driver and IBM_DB_DBI wrapper 1.0 or higher


1. Install Django

Install Django as per instructions from the Django [ website].

2. Install DB2 Django adapter (ibm_db_django)

$ pip install ibm_db_django  

Tested Operating Systems

  • Ubuntu Linux 7.04 64 bit
  • Win64/Win32 bit
  • Mac OS

Supported Databases

  • IBM DB2 Database for Linux, Unix and Windows, version 8.2 or higher.

Future Supported Databases

  • IBM Cloudscape
  • Apache Derby
  • IBM Informix Cheetah version 11.10 onwards
  • Remote connections to i5/OS (iSeries)


 * Create a new Django project by executing " startproject myproj".
 * Now go to this newly create directory, and edit file to access DB2.
 * In case of nix the steps will be like:
  $ startproject myproj
  $ cd myproj
  $ vi
 * The will be like (after adding DB2 properties):
      'default': {
         'ENGINE'     : 'ibm_db_django',
         'NAME'       : 'mydb',
         'USER'       : 'db2inst1',
         'PASSWORD'   : 'ibmdb2',
         'HOST'       : 'localhost',
         'PORT'       : '50000',
         'PCONNECT'   :  True,      #Optional property, default is false
 * Change USE_TZ to False
 * RUN python migrate
 * In the tuple INSTALLED_APPS in add the following lines:
 * Next step is to run a simple test suite. To do this just execute following command in the project we created earlier:
   $ python test #for Django-1.5.x or older
   $ Python test django.contrib.auth #For Django-1.6.x onwards, since test discovery behavior have changed
 * For Windows, steps are same as above. In case of editing file, use notepad (or any other) editor.

Database Transactions

Known Limitations of ibm_db_django adapter

  • Non-standard SQL queries are not supported. e.g. "SELECT ? FROM TAB1"
  • dbshell will not work if server is remote and client is DB2 thin client.
  • For updations involving primary/foreign key references, the entries should be made in correct order. Integrity check is always on and thus the primary keys referenced by the foreign keys in the referencing tables should always exist in the parent table.
  • DB2 Timestamps do not support timezone aware information. Thus a Datetime field including tzinfo(timezone aware info) would fail.


Your feedback is very much appreciated and expected through project ibm-db:

Contributing to the ibm_db-django python project


The developer sign-off should include the reference to the DCO in remarks(example below): DCO 1.1 Signed-off-by: Random J Developer

You can’t perform that action at this time.