× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On Wed, Jul 6, 2016 at 3:59 PM, Jack Callahan <jjcllhn@xxxxxxxxx> wrote:
Can anyone point me to a decent example that connects to the local IBMi DB2
using ibm_db_dbi, and iterates over the result set? Looking for help
mapping the connect method parameters.

That's the key. Once connected, Bob's your uncle. But how do you connect?

Right now, I'm in the same boat as you, using a Python Litmis Space.

John Yueng provided a nice example for iSeriesPython on his blog, but that
uses db2 rather than ibm_db
http://iseriespython.blogspot.ca/2013/05/copy-physical-file-to-excel-in-9-lines.html

Thanks for the plug. iSeriesPython makes it simple whether you're
using db2 or ibm_db_dbi. As you've seen from the blog post,
db2.connect() doesn't require any parameters at all, if you're happy
with the default, which (sensibly enough) is to connect to the local
database using the credentials you're already logged in with.

The ibm_db_dbi that comes with iSeriesPython is not much more complicated:

connection = ibm_db_dbi.connect('*LOCAL')

While it's not needed, you could also use the same parameter for db2:

connection = db2.connect('*LOCAL')

But IBM's Python for PASE is not quite so simple. At least, I have not
yet been able to figure out the magic incantation to connect.
Hopefully Aaron or Kevin can chime in here.

John Y.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.