473,788 Members | 2,725 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

python connect to db2

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.conne ct("localhost", "joebob","moonp ie","thangs")

anyone can help me ?

thank you

Jul 18 '05 #1
3 5292
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
10095
by: Nick Keighley | last post by:
I'm probably missing something rather obvious, but is there a known problem with getting a Python based socket program to communicate with a C based socket program? A simple echo server written in Python (the example from Python in a Nutshell actually) will happily talk to a Python based client. If a C based client is substitued the connection is refused (or so the C client reports). The C client will talk to a C server. --
4
2394
by: Steve | last post by:
I am developing an application for a client that will have data in a MS SQL Server database. Costs have to be kept down so I have to develop using the free version of any and all tools I may need. I have the SQL Server installed, running on Windows XP. I was going to develop the GUI using wxPython. My only obstacle so far is having Python (wxPython or just plain Python) connect to the database. Is there a way to use Python (installed...
13
4943
by: Graham | last post by:
I need a SQL Server or ODBC package for Python. Can anyone help please? Have search the Python packages under Database and there is no reference to either SQL Server or ODBC. Thanks Graham
23
2565
by: anton.vredegoor | last post by:
Here's my situation: I'm typing this in a public library on a computer with OS windows 2000 server. I can run Internet explorer, word, excel and powerpoint, that's it. Maybe java, but it seems to be flaky. I want to run python scripts from this computer. At home I have a multi-computer network (from better times) but no internet access anymore, I could use this to try out solutions. I also have access to a friends computer which has...
2
4512
by: Mondal | last post by:
Hi, I am using MySQL 5.0 beta and Active Python 2.4. I have the correct version of MySQLdb installed. The problem is that I can't connect to MySQL through the Active Python interactive window. Here is a sample error: >>> c=MySQLdb.Connect(host='localhost',user='root',passwd='',db='shop',port=3306) Traceback (most recent call last):
2
1659
by: anyab5 | last post by:
hey I need help in sending email, It seems that while using this set of commands from smtplib import SMTP s = SMTP() s.set_debuglevel(1) s.connect('outmail.huji.ac.il')
11
4365
by: walterbyrd | last post by:
With PHP, libraries, apps, etc. to do basic CRUD are everywhere. Ajax and non-Ajax solutions abound. With Python, finding such library, or apps. seems to be much more difficult to find. I thought django might be a good way, but I can not seem to get an answer on that board. I would like to put together a CRUD grid with editable/deletable/
2
2186
by: reizes | last post by:
I am having a problem with python threads and M2Crypto. It appears the M2Crypto used in multi-thread application blocks other threads from running: Environment: Linux 2.6 (centos 5.0), OpenSSL 0.9.8b, M2Crypto-0.17 I am using echod-thread.py and echo.py as test vehicles. Start up echod-thread.py Connect with echo.py - everything looks ok, but connect with second
1
1788
by: Scott SA | last post by:
On 5/1/08, Brian Vanderburg II (BrianVanderburg2@aim.com) wrote: Did you review this? <http://pydispatcher.sourceforge.net/> from what I understand is originally based upon this: <http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/87056> and subsequently integrated into this:
0
10173
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9967
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4070
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3674
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.