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



I did not have SI60567 install. I've installed it now. It added a .whl
file to /QOpenSys/QIBM/ProdData/OPS/Python-pkgs/ibm_db, but only one for
Python 2.7:

ibm_db-2.0.5.4-cp27-cp27m-os400_powerpc.whl

There is also an egg file, but that is for ibm_db v2.0.5.1 which I think is
what I already had installed. Is there a .whl file for ibm_db v 2.0.5.4
for Python 3?

-Jim

On Wed, Jun 22, 2016 at 10:29 PM, Kevin Adler <kadler@xxxxxxxxxx> wrote:

connect/pconnect take implementation specific parameters, so they aren't
in the PEP. We should probably document them somewhere. Here's the
function definitions from the ibm_db_dbi.py:

def connect(dsn=None, user='', password='', host='', database='',
conn_options=None):
def pconnect(dsn, user='', password='', host='', database='',
conn_options=None):

(Note, host is not supported on IBM i, since you have to specify this in
the RDB)


try this:


import ibm_db_dbi as dbi

conn = dbi.pconnect(dsn=None, database='*LOCAL', user=None, password=None)


You can specify a DSN string like so:

dbi.pconnect("DATABASE=*LOCAL;UID=user;PWD=pass")


and this should be equivalent as above *LOCAL/None/None:

dbi.pconnect("DATABASE=*LOCAL")



Now that I'm looking at it again, it looks like I missed the default
parameter for dsn on pconnect. Once that's there, you can do:

dbi.pconnect(database='*LOCAL', user=None, password=None)

(Already works on connect)



Make sure you're on the latest version of ibm_db. I'm not sure if the
original shipped version of ibm_db_dbi actually worked. Since 2.0.5.1 it
should work, but I'd get to 2.0.5.4, which is shipped with SI60567.



"OpenSource" <opensource-bounces@xxxxxxxxxxxx> wrote on 06/22/2016
09:33:07 PM:

From: Jim Steil <jim@xxxxxxxxxxxxxxx>
To: IBMi Open Source Roundtable <opensource@xxxxxxxxxxxx>
Date: 06/22/2016 09:34 PM
Subject: Re: [IBMiOSS] ibm_db and itoolkit for Python
Sent by: "OpenSource" <opensource-bounces@xxxxxxxxxxxx>

I'm trying ibm_db_dbi but can't figure out the pconnect parameters.
Trying
to connect to the local database. Any pointers?

Jim
On Jun 22, 2016 8:25 PM, "John Yeung" <gallium.arsenide@xxxxxxxxx>
wrote:

On Wed, Jun 22, 2016 at 5:54 PM, Jim Steil <jim@xxxxxxxxxxxxxxx>
wrote:
Hey John - where can I get some info on ibm_db? I tried out the
itoolkit
on my IBM i today and was a bit disappointed in what I had to do to
access
the database. I'm guessing this is not going to be the preferred
method
of
db access for Python. I'd appreciate pointers to any info you have
on
ibm_db for Python...

I agree with Kevin: Under normal circumstances, you should not be
using ibm_db directly, but rather ibm_db_dbi, to get the standard
Python database interface as laid out in PEP 249. If you're a
long-time Python user, you're probably already familiar with this
interface. If not, I find the PEP is pretty good documentation for it.

To be completely honest, I have never had especially high hopes for
itoolkit, whether for accessing data or programs:

http://yips.idevcloud.com/wiki/index.php/XMLSERVICE/Python

The documentation for the underlying XMLSERVICE has been around for
quite some time now, as well as some of its wrappers in other
languages. It just seems fundamentally verbose and cumbersome, by
Python standards. The Python version (judging by the documentation
linked to above) is about as verbose as I was expecting. It looks
almost as bulky as Java, but with a style reminiscent of Ruby. Or
maybe JavaScript. (I only have a passing familiarity with those
languages.) But I haven't given it a fair shake yet, so we'll see.

If I do become a convert to IBM's Python (as opposed to the
third-party iSeriesPython which I'm using now), I may wind up writing
my own wrapper for itoolkit, or my own fork of itoolkit.

To me, itoolkit seems to be mainly for calling native programs and
service programs (mostly written by your own shop, mostly in RPG), or
IBM system APIs. Both of these uses are probably dwindling niches, as
more and more people write stored procedures and UDFs, and IBM exposes
more and more system services to SQL. Eventually, you may be able to
just do everything with ibm_db_dbi. But I know our shop is far from
that point.

John Y.
--
This is the IBMi Open Source Roundtable (OpenSource) mailing list
To post a message email: OpenSource@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/opensource
or email: OpenSource-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/opensource.

--
This is the IBMi Open Source Roundtable (OpenSource) mailing list
To post a message email: OpenSource@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/opensource
or email: OpenSource-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/opensource.



--
This is the IBMi Open Source Roundtable (OpenSource) mailing list
To post a message email: OpenSource@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/opensource
or email: OpenSource-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/opensource.


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.