Instalacja django i sterownika db2

Założenie jest, że zainstalowany jest już db2, czy to lokalnie, czy nie (z dodatkowym pakietem programistycznym)

1. Instalacja django

Z Synaptica instalujemy pakiet django

2. Instalowanie dodatkowych pakietów pythona

Z Synaptica instalujemy pakiet python-dev

3. Instalacja narzędzia easy_install

$ sudo apt-get install python-setuptools

4. Dodanie bibliotek db2 do patha

$ nano .bashrc

na końcu pliku dodajemy :

export IBM_DB_DIR=~/sqllib
export IBM_DB_LIB=~/sqllib/lib

zapisujemy plik i wychodzimy

odpalamy :
$ source ~/.bashrc

5. Zmiana uprawnień dla pakietów pythona

Dodajemy uprawnienia dla użytkownika, na którego się zalogowaliśmy :

$ sudo chown locke /usr/local/lib/python2.6/dist-packages

6. Instalacja django db2

$ easy_install ibm_db_django

Pakiety ściągają się i instalują. I jak wszystko poszło dobrze można już korzystać z django i db2.

DB2 instalacja jako użytkownik inny niż root oraz praca z IBM Data Studio

Ostatnio miałem problem z instalacją db2 użytkownika innego niż root (non-root) installation.

Według dokumentacji ibm :
ograniczenia instalacji non-root

W takim przypadku nie działa takie narzędzie jak IBM Data Studio. Szkoda. Bo narzędzie jest praktycznie niezbędne, żeby wogóle jakoś przyzwoicie sobie pracować z bazą danych.
Rozwiązanie jest w miarę proste :

http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/index.jsp?topic=/com.ibm.db2.luw.qb.server.doc/doc/t0050570.html

trzeba ustawić ENABLE_OS_AUTHENTICATION na YES.

i wtedy w IBM Data Studio ustawiamy logowanie jak podczas logowania do systemu.

IBM Data Studio – create new database issue

For db2 there is an IDE, IBM Data Studio. After installing it with non-administration privilages, we can encounter some serious problem. After launching it, there is no possibility to create new database from within the IDE. Although in “Getting started with DB2 IBM Data Studio” redbook there is a chapter for this, when trying a connection set, by clicking “Test connection” button nothing happens. After clicking Finish and setting all settings to create new database, there will be propably an error.

The thing is, when you install the db2 as admin (sudo), there will be additional users created. Like db2inst1, dasusr1 and db2fenc1. A profile for db2inst1 (which will be an instance of the DB2) will be created under user db2inst1.

After installing IBM Data Studio the profile launch will not be added to the launching script.

Here is what to do :

  1. Locate where is db2profile (propably on /home/db2inst1/sqllib/db2profile
  2. go to your home directory, create dir bin
    1. $cd ~
    2. mkdir bin
  3. create file f.e. ibmdatastudio :
    1. echo > ibmdatastudio
  4. change mode to +x :
    1. chmod +x ibmdatastudio
  5. edit it with feavourite editor (mine is vim) : vim ibmdatastudio
  6. And enter following rows :
#!/bin/bash
if [ -f /home/db2inst1/sqllib/db2profile ]; then
. /home/db2inst1/sqllib/db2profile
fi
$HOME/IBM/DS2.2/eclipse -product com.ibm.datastudio.mini.im.product.ide

And now change the command in the IBM Data Studio Menu to $HOME/bin/ibmdatastudio

Should be possible to create new database via IBM Data Studio itself.

Follow

Get every new post delivered to your Inbox.