- class Db2Container(image: str = 'icr.io/db2_community/db2:latest', username: str = 'db2inst1', password: str | None = None, port: int = 50000, dbname: str = 'testdb', dialect: str = 'db2+ibm_db', **kwargs)¶
-
IBM Db2 database container.
Example
>>> import sqlalchemy >>> from testcontainers.db2 import Db2Container >>> with Db2Container("icr.io/db2_community/db2:latest") as db2: ... engine = sqlalchemy.create_engine(db2.get_connection_url()) ... with engine.begin() as connection: ... result = connection.execute(sqlalchemy.text("select service_level from sysibmadm.env_inst_info"))