ibmdb / python-ibmdbsa

Automatically exported from code.google.com/p/ibm-db.ibm-db-sa
Apache License 2.0
40 stars 59 forks source link

Can't load plugin: sqlalchemy.dialects:db2.ibm_db_sa #92

Closed zohebhussain closed 3 years ago

zohebhussain commented 3 years ago

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.

zohebhussain commented 3 years ago

Closing the issue. I had to reinstall ibm_db_sa