OK as you can tell I’m on Python learning roll this week.
In all the documented examples I have seen so far, I saw the following format for the connect method with no parms passed:
#----------------------------------------------------------------------
#Small program run in PASE with no DB parms passed to connect method. Failure.
#----------------------------------------------------------------------
import ibm_db_dbi as dbi
conn = dbi.connect()
When I do this I get an error that says:
ibm_db_dbi.Error: ibm_db_dbi::Error: Supplied connection object Parameter is invalid
If I add the database connection info it works:
#----------------------------------------------------------------------
#Small program run in PASE with database name with or without credentials passed. Works.
#----------------------------------------------------------------------
import ibm_db_dbi as dbi
database = "DATABASE=*LOCAL"
conn = dbi.connect(database)
So it works with passing the database. Good !!
Q: Should the connect() work without passing any info for a database connection when running natively in PASE or do I always need to pass DB info and optionally credentials ?
I’m wondering if all the slide deck samples I saw were created and run on a PC or has something changed for Python 3 and DB2. Or has the database info getting passed always been needed, but examples being provided by others are bad ?
Using - ibm_db_dbi version 2.0.5.4
FWIW - I found the answer for passing the database info online here at midrange after digging.
Just trying for some clarity as I document my samples for other. To connect() with database info or not ? 😊
Thanks
Regards,
[
http://static.helpsystems.com/hs/email/templates/signatures-final/images/hs-logo2.png]
Richard Schoen
Director of Document Management
e. richard.schoen@xxxxxxxxxxxxxxx<mailto:richard.schoen@xxxxxxxxxxxxxxx>
p. 952.486.6802
w. helpsystems.com<
http://www.helpsystems.com/>
[cid:image002.jpg@01D1A545.4C2BF250]<
http://www.linkedin.com/in/richardschoen>[cid:image003.jpg@01D1A545.4C2BF250]<
http://www.twitter.com/richardschoen>
As an Amazon Associate we earn from qualifying purchases.