By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,978 Members | 1,389 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,978 IT Pros & Developers. It's quick & easy.

python connect to db2

P: n/a
hi,all

i am python newbie,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,

i think a way like python connect to mysql :

db=_mysql.connect("localhost","joebob","moonpie"," thangs")

anyone can help me ?

thank you

Jul 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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.
Jul 18 '05 #2

P: n/a
yuzx wrote:
anyone can help me ?


this might help:

http://www6.software.ibm.com/reg/dev...HW03&S_CMP=EDU

jacek
Jul 18 '05 #3

P: n/a
yuzx wrote:
>>> conn = DB2.connect(dsn='sample', uid='db2inst1', pwd='ibmdb2')

but i don't know about dsn,


If the database is DB2/400 and you try to connect from iSeries, dsn
would be '*local' for local database, or its name (not hostname or IP
address!) as returned by dsprdbdire command for remote databases.

--
Jarek Zgoda
http://jpa.berlios.de/ | http://www.zgodowie.org/
Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.