python connect to db2

Michael Ströder michael at stroeder.com
Fri Jan 14 04:19:33 EST 2005


yuzx wrote:
> 
> i try to connect to db2 use python,i find it on
> python-db2 doc:
> 
> 	$ python
> 	>>> import DB2
> 	>>> conn = DB2.connect(dsn='sample', uid='db2inst1', pwd='ibmdb2')
> 	>>> curs = conn.cursor()
> 
> but i don't know about dsn,

It's the host name. In a former project (using module DB2 together with 
'IBM DB2 Connect' to access OS/390 database via TCP/IP) I had to invoke 
a special catalog db2 script before being able to use the host name.

Ciao, Michael.



More information about the Python-list mailing list