You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1/
We have installed DB2_RTC_12_1_Linux_x86-64.tar.gz
Using DB2_CUEi_QS_Activation_12.1 we have activated the license.
db2licm -l is showing :
Product name: "DB2 Connect Unlimited Edition for iSeries"
License type: "Client Device"
Expiry date: "Permanent"
Product identifier: "db2consv"
Version information: "12.1"
try:
conn = ibm_db.connect(conn_str, '', '')
print("Connexion réussie à DB2")
ibm_db.close(conn)
except Exception as e:
print(f"Échec de connexion: {e}")
3/
Execution fails :
root@SV-NESSIET:/opt/ibm# python3 test.py
Échec de connexion: [IBM][CLI Driver] SQL1598N An attempt to connect to the database server failed because of a licensing problem. SQLSTATE=42968 SQLCODE=-1598
I have license
e have activated the license.
db2licm -l is showing :
Product name: "DB2 Connect Unlimited Edition for iSeries"
License type: "Client Device"
Expiry date: "Permanent"
Product identifier: "db2consv"
Version information: "12.1"
@cavamacmoe You have installed DB2_RTC client as /opt/ibm/db2/V12.1/ and then installed ibm_db and trying to connect to iSeries server but getting SQL1598N error, right?
I think the issue lies in how you installed ibm_db. Please note that ibm_db uses db2 odbc driver for connectivity. So, when we install ibm_db, by default ibm_db downloads its own odbc/clidriver from ibm hosted site and use it rather than any existing client/driver in the system. Your RTC client too has odbc driver and you want ibm_db to use it. For that you need to instruct ibm_db to use existing RTC client and do not download its own clidriver by setting IBM_DB_HOME environment variable before installation of ibm_db.
But, above steps too will not work as ibm_db on linux is a precompiled wheel package which includes clidriver too. So, correct commands would be as below:
Above pip command will install ibm_db from source code and not from the precompiled wheel image. So, your system should have gcc compiler to compile native c++ codes of ibm_db which interacts with odbc driver.
If you install ibm_db using pip install ibm_db --no-binary :all: --no-cache-dir command, it will use /opt/ibm/db2/V12.1/lib/libdb2.so.1 file for connectivity. You have installed license file for it and it should connect to iSeries server without any error.
But, ibm_db requires odbc header files too during compilation of native c++ code. So, make sure you have /opt/ibm/db2/V12.1/include directory too. If you do not have this directory, installation of ibm_db will fail. I think RTC client do not has include directory which contains SQL and CLI header files. DB2 CLIENT installer comes with include directory. Also, IBM Data Server Driver package comes with include directory.
Note that you can use ibm_db with IBM Db2 Data Server Driver Package, IBM Db2 Client Package and IBM DB2 Server installations only. The clidriver that ibm_db downloads by default is a minimized version of IBM Db2 Data Sever Package which includes include directory too. The clidriver downloaded from fix-central do not come with include directory.
If you can get db2connect license file f.e. db2consv_is.lic, you can copy it under ...\site_package\clidriver\license directory. This clidriver you get when you install ibm_db using pip install ibm_db command on Linux. ibm_db uses this clidriver for connectivity and if it has license file under license directory, connection to iSeries will succeed.
So, you have below options to fix this issue:
Either install DB2 client package or Db2 Data Server driver package then set IBM_DB_HOME and install ibm_db using above command.
Get db2connect license file and copy under clidriver/license directory which will use its site_package/clidriver for connectivity and not /opt/ibm/db2/V12.1/.
Activity
Earammak commentedon Jul 11, 2025
@cavamacmoe , It says that you do not have db2connect license. Please refer to the document for License requirement: https://github.com/ibmdb/python-ibmdb#Licenserequirements
cavamacmoe commentedon Jul 11, 2025
I have license
e have activated the license.
db2licm -l is showing :
Product name: "DB2 Connect Unlimited Edition for iSeries"
License type: "Client Device"
Expiry date: "Permanent"
Product identifier: "db2consv"
Version information: "12.1"
Earammak commentedon Jul 11, 2025
@cavamacmoe , Can you share " db2level " command output.
Earammak commentedon Jul 11, 2025
@cavamacmoe I hope you referred this page: https://github.com/ibmdb/python-ibmdb?tab=readme-ov-file#troubleshooting-sql1598n-error .
bimalkjha commentedon Jul 11, 2025
@cavamacmoe You have installed DB2_RTC client as
/opt/ibm/db2/V12.1/and then installedibm_dband trying to connect to iSeries server but gettingSQL1598Nerror, right?I think the issue lies in how you installed
ibm_db. Please note thatibm_dbusesdb2 odbc driverfor connectivity. So, when we installibm_db, by defaultibm_dbdownloads its ownodbc/clidriverfrom ibm hosted site and use it rather than any existing client/driver in the system. Your RTC client too has odbc driver and you want ibm_db to use it. For that you need to instruct ibm_db to use existing RTC client and do not download its own clidriver by settingIBM_DB_HOMEenvironment variable before installation of ibm_db.But, above steps too will not work as ibm_db on linux is a precompiled wheel package which includes
clidrivertoo. So, correct commands would be as below:Above pip command will install
ibm_dbfrom source code and not from the precompiled wheel image. So, your system should have gcc compiler to compile native c++ codes of ibm_db which interacts with odbc driver.If you install
ibm_dbusingpip install ibm_db --no-binary :all: --no-cache-dircommand, it will use/opt/ibm/db2/V12.1/lib/libdb2.so.1file for connectivity. You have installed license file for it and it should connect to iSeries server without any error.But,
ibm_dbrequires odbc header files too during compilation of native c++ code. So, make sure you have/opt/ibm/db2/V12.1/includedirectory too. If you do not have this directory, installation ofibm_dbwill fail. I think RTC client do not has include directory which contains SQL and CLI header files.DB2 CLIENTinstaller comes with include directory. Also,IBM Data Server Driver packagecomes with include directory.Note that you can use
ibm_dbwithIBM Db2 Data Server Driver Package,IBM Db2 Client PackageandIBM DB2 Serverinstallations only. Theclidriverthatibm_dbdownloads by default is a minimized version ofIBM Db2 Data Sever Packagewhich includesincludedirectory too. Theclidriverdownloaded fromfix-centraldo not come withincludedirectory.If you can get db2connect license file f.e.
db2consv_is.lic, you can copy it under...\site_package\clidriver\licensedirectory. Thisclidriveryou get when you installibm_dbusingpip install ibm_dbcommand on Linux.ibm_dbuses thisclidriverfor connectivity and if it has license file under license directory, connection to iSeries will succeed.So, you have below options to fix this issue:
clidriver/includedirectory to/opt/ibm/db2/V12.1/then set IBM_DB_HOME and install ibm_db. It should work. Just run below commands on your Linux system and it should work:Let us know which one you tried. Thanks.
cavamacmoe commentedon Jul 15, 2025
@bimalkjha :
I tried "pip install ibm_db --no-binary :all: --no-cache-dir" before but include files were missing
"wget https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/v12.1.0/linuxx64_odbc_cli.tar.gz" solve my problem.
Thanks you very much