python-ibmdb: release level error

  • Operating System Name: Windows 10
  • db2level output from clidriver if in use: SQLCODE=-5048 [IBM][CLI Driver] SQL5048N The release level of the database client is not supported by the release level of the database server.
  • Target Db2 Server Version: 7.2
  • Python Version: Tried with 2.7 and 3.10.5 (Both 32 and 64 bit)
  • ibm_db version: ibm-db==3.1.1
import ibm_db

connectionSettings = [
    {
        "dbtype": "DB2",
        "hostname": "DBSERVERHOSTNAME",
        "database": "DBNAME",
        "username": "DBUSER",
        "password": "DBPASS",
        "port": 50000,
        "protocol": "TCPIP"
    }
]

def connectToDB2(hostname, database, username, password, port, protocol):
    try:
        ibm_db.connect("DATABASE=BSS_CDRS;HOSTNAME={};PORT={};PROTOCOL={};UID={};PWD={};".format(hostname, port, protocol, username, password), "", "")
    except:     
        print("no connection: ", ibm_db.conn_errormsg())
    else:
        print("Connected to the database.")

for conn in connectionSettings:
    connectToDB2(conn["hostname"], conn["database"], conn["username"], conn["password"], conn["port"], conn["protocol"])

I keep getting the error described above and I wanted to ask if this is a normal behavior or not. And if yes, which ibm_db version do I need to install and use to be compatible with my version of DB2 Server?

Thank you.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

Also take care to verify this on a non-production environment first , and when doing initial connection to Db2 (which should initially be via the db2cmd command line, the first connection should be with an account that has sysadm or dbadm privilege on the target database(s) to allow the relevant packages to be bound automatically). If you lack such access with the account(s) you use, then ask your DBA to manually bind all of the cli utilities supplied by the V9.x client (the DBA will know how to use the client side tools to achieve this essential task, otherwise client connections and/or other queries and commands will all fail with missing packages errors, until the relevant client side bindfiles are bound into the database ).

@analyserdmz I assume the target Db2 Server version 7.2 is an LUW server and not AS400 server. In that case, you can download the db2 v9.1.11 client installer from here. Install it, and set system environment variable IBM_DB_HOME to full_path_of_install_directory_of_db2_client. Then uninstall the existing ibm_db and go for fresh installation. When environment variable IBM_DB_HOME is set and pointing to a db2 client/server installation, ibm_db do not download the latest clidriver from ibm hosted website and use the existing one. It should fix your problem. Thanks.

Find a v9.1 driver then, uninstall the current clidriver driver (manually) , and try installing the v9.1 driver . Most of the likely installation-time errors might have workarounds with competent troubleshooting. Very few sites may be trying to access a v7.x Db2-LUW server with today’s python versions, which means you are likely to be on your own with the integration efforts (but you may succeed, or be able to workaround some problems). Of course, if you have a large enough budget, you can pay people to develop solutions…