CData Python Connector for DB2

Build 24.0.9060

Connecting

Connecting With a Dialect URL

Establishing a connection using SQLAlchemy requires a specific URL format. For this connector, you can create the engine using either of the following URL formats:

Format 1


from sqlalchemy import create_engine
engine = create_engine("cdata_db2:///?Server=10.0.1.2;Port=50000;User=admin;Password=admin;Database=test")

Format 2


from sqlalchemy import create_engine
engine = create_engine("cdata_db2://MyUser:MyPassword@MyServer:MyPort/MyDatabase")

For SQLAlchemy 2.0, the dialect name is db2_2. To establish a connection, use the following URL format:

from sqlalchemy import create_engine
engine = create_engine("quickbooks_2:///?User=test;Password=test;URL=http://localhost:8166;")

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9060