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 [http://www.djangoproject.com/]

The adapter has been developed and is supported by IBM

Prerequisites for Django on Python

Installation

1. Install Django

Install Django as per instructions from the Django [http://docs.djangoproject.com/en/dev/topics/install/#installing-an-official-release website].

2. Install DB2 Django adapter (ibm_db_django)

$ pip install ibm_db_django==1.2.0.0a0  

Tested Operating Systems

Supported Databases

Future Supported Databases

Testing

 * Create a new Django project by executing "django-admin.py startproject myproj".
 * Now go to this newly create directory, and edit settings.py file to access DB2.
 * In case of nix the steps will be like:
  {{{
  $ django-admin.py startproject myproj
  $ cd myproj
  $ vi settings.py
  }}}
 * The settings.py will be like (after adding DB2 properties):
   {{{
   DATABASES = {
      '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 manage.py migrate

 * In the tuple INSTALLED_APPS in settings.py add the following lines:
   {{{
   'django.contrib.flatpages',
   'django.contrib.redirects',
   'django.contrib.comments',
   'django.contrib.admin',
   }}}
 * Next step is to run a simple test suite. To do this just execute following command in the project we created earlier:
   {{{
   $ python manage.py test #for Django-1.5.x or older
   $ Python manage.py 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 settings.py file, use notepad (or any other) editor.

Database Transactions

Known Limitations of ibm_db_django adapter

Feedback/Support

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

Contributing to the ibm_db-django python project

See CONTRIBUTING

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