You can test the Python database connectivity with the db2dsdriver.cfg file to ensure that the db2dsdriver.cfg file is valid and the Python driver is installed correctly.
You must ensure that the IBM® data server client or IBM Data Server Driver Package software is installed and the db2dsdriver.cfg file is created in your environment with the required data source name (DSN) entry. You can use the contents of the db2dsdriver.cfg.sample file to create the db2dsdriver.cfg file.
You must have a working Python environment. For more information, see Python, SQLAlchemy and Django Framework application development for IBM data servers.
$ easy_install <DB2_Install_Path>/python32/ibm_db-xx-xx-xx-xx.egg
$ easy_install <DB2_Install_Path>/python32/ibm_db_django-xx-xx.egg
$ easy_install <DB2_Install_Path>/python32/ibm_db_sa-xx-xx.egg
If
you have a 64-bit Python and 64-bit IBM data
server driver environment, you must reference the 64-bit Python drivers
packages (*.egg) that are in the <DB2_Install_Path>/python64 path.$ easy_install <DB2_Install_Path>/python64/ibm_db-xx-xx-xx.egg
$ easy_install <DB2_Install_Path>/python64/ibm_db_django-xx-xx.egg
$ easy_install <DB2_Install_Path>/python64/ibm_db_sa-xx-xx.egg
The <DB2_Install_Path> is
the installation path of the IBM data server client or the IBM Data
Server Driver Package software.The 32-bit Python environment must access
the 32-bit CLI driver and the 32-bit Python driver. If you attempt
to install the 64-bit Python driver by using the easy_install tool
in a 32-bit Python environment or if the 64-bit CLI driver is installed, the following message is returned:IBM DataServer environment not set
If you want to obtain and install the latest Python driver, see Setting up the Python environment for IBM data servers.
To test the Python connectivity with the db2dsdriver.cfg file:
ImportError: wrong ELF class: ELFCLASS32
To
configure the 32-bit IBM data
server driver:$ python validate_install.py sampledsn username password
Connection to database sampledsn is successful.
$ python validate_install.py sample samplehost.domain.com 50000 username password
Connection to database sample is successful.