I want to create sqlalchemy engine with the use of DSN
driver='db2+ibm_db'
dsn='BLUDB'
url = f'{driver}://{user}:{password}@{dsn}/{db}'
create_engine(url).connect()
Currently my code is with host and port and it is working fine, but we want to update it with dsn
from sqlalchemy import create_engine
from sqlalchemy.engine import Connection
driver='db2+ibm_db'
url = f'{driver}://{user}:{password}@{host}:{port}/{db}'
if params:
url = f'{url}?{params}'
create_engine(url).connect()
While trying to connect it with DSN it is throwing below error
Traceback (most recent call last):
File "C:\...\env\lib\site-packages\ibm_db_dbi.py", line 599, in connect
conn = ibm_db.connect(dsn, '', '', conn_options)
SQLCODE=-1336M][CLI Driver] SQL1336N The remote host "BLUDB" was not found. SQLSTATE=08001