ibmdb/python-ibmdbsa

Trouble using credentials for SSL connection with flask-sqlalchemy

data-henrik opened this issue · 5 comments

I am trying to initialize a connection to Db2 Warehouse on Cloud by setting SQLALCHEMY_DATABASE_URI to one of the provided credential parts. They look like this:


{
  "hostname": "db2w-host.us-south.db2w.cloud.ibm.com",
  "password": "passwd",
  "https_url": "https://db2w-host.us-south.db2w.cloud.ibm.com",
  "port": 50001,
  "ssldsn": "DATABASE=BLUDB;HOSTNAME=db2w-host.us-south.db2w.cloud.ibm.com;PORT=50001;PROTOCOL=TCPIP;UID=bluadmin;PWD=passwd;Security=SSL;",
  "host": "db2w-host.us-south.db2w.cloud.ibm.com",
  "uri": "db2://bluadmin:passwd@db2w-host.us-south.db2w.cloud.ibm.com:50001/BLUDB?ssl=true;",
  "db": "BLUDB",
  "username": "bluadmin",
  "ssljdbcurl": "jdbc:db2://db2w-host.us-south.db2w.cloud.ibm.com:50001/BLUDB:sslConnection=true;"
}

I tried ssldsn and uri, but both result in errors. What is the correct connection URI? Could you

  • improve the documentation and add more examples with SSL connections
  • support direct consumption of credentials coming from Db2 services

@data-henrik Were you able to get any help for this issue?

AFAIK it is open

Hi,

For Sql Alchemy can you need to use the URI syntax for connection.
Also while providing the URI
"uri": "db2://bluadmin:passwd@db2w-host.us-south.db2w.cloud.ibm.com:50001/BLUDB?ssl=true;",

Can you please check after changing the dialect from db2 to ibm_db_sa
ibm_db_sa://bluadmin:passwd@db2w-host.us-south.db2w.cloud.ibm.com:50001/BLUDB?ssl=true

can you try once with the above mentioned URI.

Please also give a try by changing the ssl=true to SECURITY=SSL
ibm_db_sa://bluadmin:passwd@db2w-host.us-south.db2w.cloud.ibm.com:50001/BLUDB?SECURITY=SSL

Just try the above combinations and let me know.

Thanks.

Hi,

Just wanted to check if the above solution provided worked for you or you still have the issue seen.

Can you please let me know.

Thanks.