On Fri, Jul 8, 2016 at 12:28 PM, Kevin Adler <kadler@xxxxxxxxxx> wrote:
Simplest is
ibm_db_dbi.[p]connect("DATABASE=*LOCAL")
That would be simple enough, but it doesn't work on Litmis Spaces:
*** begin quote ***
Traceback (most recent call last):
File "/QOpenSys/QIBM/ProdData/OPS/Python3.4/lib/python3.4/site-packages/ibm_db-2.0.5.1-py3.4-os400-powerpc.egg/ibm_db_dbi.py",
line 585, in connect
ibm_db.set_option(conn, {SQL_ATTR_CURRENT_SCHEMA : user}, 1)
Exception: Supplied connection object Parameter is invalid
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/QOpenSys/QIBM/ProdData/OPS/Python3.4/lib/python3.4/site-packages/ibm_db-2.0.5.1-py3.4-os400-powerpc.egg/ibm_db_dbi.py",
line 587, in connect
raise _get_exception(inst)
ibm_db_dbi.Error: ibm_db_dbi::Error: Supplied connection object
Parameter is invalid
*** end quote ***
ibm_db_dbi.connect(dsn=None, database='*LOCAL', user=None, password=None)
# connect has a bug where you have to specify dsn=None currently
*** begin quote ***
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/QOpenSys/QIBM/ProdData/OPS/Python3.4/lib/python3.4/site-packages/ibm_db-2.0.5.1-py3.4-os400-powerpc.egg/ibm_db_dbi.py",
line 547, in connect
raise InterfaceError("connect expects a not None dsn value")
ibm_db_dbi.InterfaceError: ibm_db_dbi::InterfaceError: connect expects
a not None dsn value
*** end quote ***
ibm_db_dbi.pconnect(database='*LOCAL', user=None, password=None)
*** begin quote ***
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: pconnect() missing 1 required positional argument: 'dsn'
*** end quote ***
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.
That kind of stuff is pretty simple. I could probably manage some pull
requests, once I'm able to establish access to an environment in which
I can test my own mods.
John Y.
As an Amazon Associate we earn from qualifying purchases.