|
|
README
Quick Getting Started Steps (README)
Install IBM_DB support for SQLAlchemy
The IBM_DB_SA adapter provides the Python/SQLAlchemy interface to IBM Data Servers. The implementation conforms to SQLAlchemy 0.4.0 specification.
The IBM_DB_SA adapter is packaged as a Python Egg component and is dependent on:
- SQLAlchemy 0.4.0
- IBM_DB_DBI Python wrapper (ibm_db_dbi)
- IBM_DB Python driver (ibm_db)
- IBM Data Server Driver for ODBC and CLI (db2cli) Version 9
Installation and configuration
To install the IBM_DB_SA Python egg component (.egg), use the standard setuptools provided by the Python Easy Install, which is available through the Python Enterprise Application Kit community portal.
After installing Easy Install, perform these additional steps to install the IBM_DB_SA egg component:
- To install the IBM_DB_SA egg component available in the remote repository:
Windows:> easy_install ibm_db_saLinux or UNIX:$ sudo easy_install ibm_db_sa
- To install the IBM_DB_SA egg component from the downloaded .egg file:
Windows:> easy_install ibm_db_sa-0.1.1-py2.5.eggLinux or UNIX:$ sudo easy_install ibm_db_sa-0.1.1-py2.5.egg
- To uninstall the IBM_DB_SA egg component:
Windows:> easy_install -m ibm_db_sa==0.1.1 > rmdir Python25\Lib\site-packages\ibm_db_sa-0.1.1-py2.5.eggLinux or UNIX:$ sudo easy_install -m ibm_db_sa==0.1.1 $ sudo rm -rf /usr/lib/python2.5/site-packages/ibm_db_sa-0.1.1-py2.5.egg
Quick Sanity Test Example
IBM_DB SA adapter sanity test
$ python
Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlalchemy
>>> from sqlalchemy import *
>>> import ibm_db_sa.ibm_db_sa
>>> db2 = sqlalchemy.create_engine('ibm_db_sa://db2inst1:secret@host.name.com:50000/pydev')
>>> metadata = MetaData()
>>> users = Table('users', metadata,
Column('user_id', Integer, primary_key = True),
Column('user_name', String(16), nullable = False),
Column('email_address', String(60), key='email'),
Column('password', String(20), nullable = False)
)
>>> metadata.bind = db2
>>> metadata.create_all()
>>> users_table = Table('users', metadata, autoload=True, autoload_with=db2)
>>> users_tableIBM_DB DB-API wrapper sanity test
$ python
Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ibm_db
>>> ibm_db_conn = ibm_db.connect('pydev', 'db2inst1', 'secret')
>>> import ibm_db_dbi
>>> conn = ibm_db_dbi.Connection(ibm_db_conn)
>>> conn.tables('SYSCAT', '%')Example: Using the Data Source Name (DSN) through CLI configuration
$ cat ./clidriver/db2cli.ini ... [pydb] Database=pydev Protocol=tcpip Hostname=host.name.com Servicename=50000 uid=db2inst1 pwd=secret
$ python
Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlalchemy
>>> from sqlalchemy import *
>>> import ibm_db_sa.ibm_db_sa
>>> db2 = sqlalchemy.create_engine('ibm_db_sa:///pydb?UID=db2inst1')
>>> ...
>>> db2 = sqlalchemy.create_engine('ibm_db_sa:///?DSN=pydb;UID=db2inst1')
>>> ...Tested operating systems
- SuSE Linux Server 9 32-bit
- Ubuntu Linux 7.04 32-bit
- MS Windows 32-bit
Supported databases
- IBM DB2 Version 9.5 for Linux, UNIX, and Windows
- IBM DB2 Version 9.1 for Linux, UNIX, and Windows
- IBM DB2 Universal Database for Linux, UNIX, and Windows, Version 8
- Informix IDS 11.10 (Cheetah)
Future supported databases
- Remote connections to i5/OS (iSeries)
- Remote connections to z/OS (DB2 for z/OS)
Feedback
Your feedback is very much appreciated and expected through project ibm-db:
- ibm-db project: http://code.google.com/p/ibm-db/
- ibm-db wiki: http://code.google.com/p/ibm-db/w/list
- ibm-db issues reports: http://code.google.com/p/ibm-db/issues/list
- ibm-db developers: opendev@us.ibm.com
