I am trying to write a basic flask app using SQLalchemy and connecting to DB2. I am able to connect to db2 using ibm_db but when I try it using sqlalchemy I get exceptions. code used:
this gives me plugin ibm_db_sa plugin not found error.
The other option I have tried is to remove db2. i.e.
app.config['SQLALCHEMY_DTABASE_URI'] = f"+ibm_db_sa://{UID}:{PWD}@hostname:port/DB"
this gives me a different kind of error:
"ibm_db_dbi::OperationalError:Exception('[IBM][CLI Driver} SQL30061N The database alias or database name was not found at the remote node"
I have checked BMC and the database name is correct.
I am not sure what I am missing here. Any insight will be very helpful.
Also, in effort we use multiple databases under the host name. How can use sqlalchemy to connect to all the databases under a hostname ? Idea is to write run a query by joining multiple tables spanning across multiple databases.
I am trying to write a basic flask app using SQLalchemy and connecting to DB2. I am able to connect to db2 using ibm_db but when I try it using sqlalchemy I get exceptions. code used:
app.config['SQLALCHEMY_DTABASE_URI'] = f"db2+ibm_db_sa://{UID}:{PWD}@hostname:port/DB"
this gives me plugin ibm_db_sa plugin not found error.
The other option I have tried is to remove db2. i.e. app.config['SQLALCHEMY_DTABASE_URI'] = f"+ibm_db_sa://{UID}:{PWD}@hostname:port/DB"
this gives me a different kind of error: "ibm_db_dbi::OperationalError:Exception('[IBM][CLI Driver} SQL30061N The database alias or database name was not found at the remote node" I have checked BMC and the database name is correct.
I am not sure what I am missing here. Any insight will be very helpful.
Also, in effort we use multiple databases under the host name. How can use sqlalchemy to connect to all the databases under a hostname ? Idea is to write run a query by joining multiple tables spanning across multiple databases.
Thank you for you time and help on this.