[DB-SIG] Reading DB2 on AIX in Python scripts
Harald Armin Massa
haraldarminmassa at gmail.com
Tue Oct 23 17:06:15 CEST 2007
David,
never done that. But a quick google reveals:
http://sourceforge.net/projects/pydb2/
there is a python package, called pydb2.
So the most propable code will be:
import pydb2
cn=pydb2.connect(database="database", host="host", user="user",
password="password")
cs=cn.cursor()
cs.execute("select foo from bar")
for row in cs.fetchall():
print row
using help (pydb2.connect) you may get some information about the
fitting connect-parameters for your database. But I guess you know
much more about DB2 than me and will figure that out. (i.e.: with
Oracle it is just connect("user","pwd", "instanz")
Best wishes,
Harald
On 10/23/07, David.Lloyd at cis.co.uk <David.Lloyd at cis.co.uk> wrote:
>
> Hello,
>
> I am new to Python and I am trying to work out if it is possible to use
> Python to read DB2 version 8/9 tables on an AIX server. The code will
> reside on the same server as the database.
>
> If it is possible, does anyone have any examples of connecting to a DB2
> database they could forward to me?
>
> Regards
>
> Dave Lloyd
> *************************************************************************
>
> This e-mail may contain confidential information or be privileged. It is intended to be read and used only by the named recipient(s). If you are not the intended recipient(s) please notify us immediately so that we can make arrangements for its return: you should not disclose the contents of this e-mail to any other person, or take any copies. Unless stated otherwise by an authorised individual, nothing contained in this e-mail is intended to create binding legal obligations between us and opinions expressed are those of the individual author.
>
> The CIS marketing group, members of which are authorised and regulated by the Financial Services Authority, includes:
> Co-operative Insurance Society Limited Registered in England number 3615R
> CIS General Insurance Limited Registered in England number 29999R
> CIS Unit Managers Limited Registered in England and Wales number 2369965
> CIS Policyholder Services Limited Registered in England and Wales number 3390839
>
> Registered offices: Miller Street, Manchester M60 0AL
> Internet http://www.cis.co.uk
>
>
> CIS & the CIS logo (R) Co-operative Insurance Society Limited
>
>
> *************************************************************************
> _______________________________________________
> DB-SIG maillist - DB-SIG at python.org
> http://mail.python.org/mailman/listinfo/db-sig
>
--
GHUM Harald Massa
persuadere et programmare
Harald Armin Massa
Spielberger Straße 49
70435 Stuttgart
0173/9409607
fx 01212-5-13695179
-
EuroPython 2008 will take place in Vilnius, Lithuania - Stay tuned!
More information about the DB-SIG
mailing list