× 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.



"OpenSource" <opensource-bounces@xxxxxxxxxxxx> wrote on 07/07/2016
12:14:50 PM:

From: John Yeung <gallium.arsenide@xxxxxxxxx>
To: IBMi Open Source Roundtable <opensource@xxxxxxxxxxxx>
Date: 07/07/2016 12:15 PM
Subject: Re: [IBMiOSS] IBM i python ibm_db_dbi example usage
Sent by: "OpenSource" <opensource-bounces@xxxxxxxxxxxx>
SNIP

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.

I covered this previously:
http://archive.midrange.com/opensource/201606/msg00066.html

Simplest is

ibm_db_dbi.[p]connect("DATABASE=*LOCAL")

or

ibm_db_dbi.connect(dsn=None, database='*LOCAL', user=None, password=None)
# connect has a bug where you have to specify dsn=None currently
ibm_db_dbi.pconnect(database='*LOCAL', user=None, password=None)

One of these days, I'll get around to adding a default for dsn on
connect() and setting user and password defaults to None instead of empty
strings (Pull requests welcome). Then you could do:

ibm_db_dbi.connect(database='*LOCAL')

if you wanted.


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.