Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > python connect to db2

Reply
Thread Tools

python connect to db2

 
 
yuzx
Guest
Posts: n/a
 
      01-14-2005
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

 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?Michael_Str=F6der?=
Guest
Posts: n/a
 
      01-14-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.
 
Reply With Quote
 
 
 
 
Jacek
Guest
Posts: n/a
 
      01-14-2005
yuzx wrote:

> anyone can help me ?


this might help:

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

jacek
 
Reply With Quote
 
Jarek Zgoda
Guest
Posts: n/a
 
      01-14-2005
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/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DB2 under Windows XP - "Missing DB2 Libraries or headers" daf@jaade.com Ruby 0 04-26-2006 03:08 PM
Installing ruby-db2-0.4 for DB2 gives SQLConnect() errors. Dinesh Ruby 0 04-03-2006 04:20 AM
Hibernate 3.1 and db2 connecting using com.ibm.db2.jcc.DB2Driver crawstevenford@gmail.com Java 0 02-19-2006 08:20 PM
using jdbc to connect to db2 r_stringer66@yahoo.com Java 1 07-27-2005 05:51 AM
connect to db2 database using dbi? Kate Perry Perl 0 07-10-2003 06:44 PM



Advertisments