[Python] Python quits when connecting to DB2

Discussão em 'Python' iniciado por Stack, Junho 8, 2025.

  1. Stack

    Stack Membro Participativo

    I have just installed ibm_db to connect Python to a DB2 database.

    pip install ibm_db


    The database is a remote database hosted on IBM with an impossibly long name. Reading what I could around the place, I have the following connection script:

    import ibm_db, importlib, ibm_db_dbi
    hostname, port, database, protocol, uid, pwd = ('…', …, '…', 'TCPIP', '…', '…')

    connection = ibm_db_dbi.connect(f'HOSTNAME={hostname};PORT={port};DATABASE={database};PROTOCOL={protocol};UID={uid};PWD={pwd}', '', '')


    using the connection data supplied by IBM.

    When I try, I get the following error message:

    [​IMG]

    I get the same on PyCharm and Idle, so it’s not the software.

    Is there a trick to making this work?

    I’m using Python 3.13.2 on a Mac Mini M1 with macOS Sequoia 15.5.

    Continue reading...

Compartilhe esta Página