I want to use ibm_db_django
to connect to a DB2-database.
The database runs on a Windows 7 x64 system. I also installed ibm_db
and ibm_db_django
on the same system. I developed my app on this computer and everything works fine.
Now I wanted to deploy the django-project to a debian 6 x64 system. After some trial I installed the IBM Data Server Client
(version 9.5, Fix Pack 10) and added the ODBC-driver for 32-bit. After this I was able to install ibm_db
and ibm_db_django
. Now I am able to import ibm_db
(as long as I am logged in as the db2inst1-user).
The problem is that I cannot connect to my DB2-server:
db2inst1@debian:~$ sqllib/db2profile
db2inst1@debian:~$ source /home/ai/project/ENV/bin/activate
(ENV)db2inst1@debian:~$ python /home/ai/project/sourcecode/manage.py shell
>>> from django.db import connections
>>> connections['db2'].cursor()
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/ai/ENV/lib/python2.6/site-packages/django/db/backends/__init__.py", line 324, in cursor
cursor = self.make_debug_cursor(self._cursor())
File "/home/ai/project/ENV/lib/python2.6/site-packages/ibm_db_django/base.py", line 191, in _cursor
self.connection, cursor = self.databaseWrapper._cursor( None, kwargs )
File "/home/ai/project/ENV/lib/python2.6/site-packages/ibm_db_django/pybase.py", line 74, in _cursor
connection = Database.pconnect( **kwargs )
File "/home/ai/project/ENV/lib/python2.6/site-packages/ibm_db_dbi.py", line 634, in pconnect
raise _get_exception(inst)
OperationalError: ibm_db_dbi::OperationalError: [IBM][CLI Driver] SQL30081N Kommunikationsfehler. Verwendetes Kommunikationsprotokoll:"TCP/IP". Verwendete Kommunikations-API: "SOCKETS". Position, an der der Fehler erkannt wurde: "192.168.23.123". \xc3\x9cbertragungsfunktion, die den Fehler festgestellt hat: "connect". Protokollspezifische(r) Fehlercode(s): "110", "*", "*". SQLSTATE=08001 SQLCODE=-30081
I defined the database-connection like this:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'database_name',
'USER': 'username',
'PASSWORD': 'password',
'HOST': '',
'PORT': '',
},
'db2': {
'ENGINE' : 'ibm_db_django',
'NAME' : 'SAMPLE',
'USER' : 'username',
'PASSWORD' : 'password',
'HOST' : '192.168.23.123',
'PORT' : '50000',
'PCONNECT' : True, #Optional property, by default it is false
}
}
I only changed the HOST, compared to the running version on my Windows 7 development machine. Pinging the IP does work and the connection should be stable (the debian-machine is a virtual machine connected to the same router as the physical windows-7-machine).
Does anyone have a clue?