Akashneel
Akashneel

Reputation: 11

license error while making connection ibm db2 using python and ibm_db library

I am trying to make connection with db 2 , so here is my code that i have used from the documentation

import _db 
conn=ibm_db.connect("DATABASE=*LOCAL;HOSTNAME=*.*.*.*;PORT=port;PROTOCOL=TCPIP;UID=uid;PWD=pwd",'','')
connState = ibm_db.active(conn)
print(connState)

The error which i get in return is

Exception: [IBM][CLI Driver] SQL1598N  An attempt to connect to the database server failed because of a licensing problem.  SQLSTATE=42968 SQLCODE=-1598

I don't know how to resolve this , any help would be highly appreciated!!!!!

Upvotes: 0

Views: 2331

Answers (1)

mao
mao

Reputation: 12287

SQL1598N is a frequently asked question when connecting CLI drivers to either Db2-for-Z/OS native or Db2-for-i (as/400, IBM i ,...).

The Db2 CLI driver will throw SQL1598N if any of these is true:

  • you do not have a licence file
  • you have a licence file but you did not deploy it correctly
  • you have a licence file but it is for a different version of Db2-server
  • you have a jdbc licence file instead of an ODBC licence file

You can either purchase a licence (for Db2-connect-personal) and deploy it, OR you can avoid the need for a licence if any of the following are true:

  • you want to connect to Db2-for-Z/OS and your company already has a Db2-connect gateway installed that you can use to gain indirect access to Db2-for-Z/OS.

  • you want to connect to Db2-for-Z/OS and your Z/OS DBA knows how to configure server-based licensing instead of workstation based licensing

  • you can find or use a licence file (db2_connect_pe.lic or similar) on a different workstation that you can deploy legally to your workstation that runs python, into the clidriver license subdirectory IBM supplied CLI drivers (when packaged as "clidriver", or "Data Server Client") for both Db2-for-Z/OS and Db2-for-i are not free, and require a licence to be purchased and deployed, either directly or indirectly. However, there is no licence required when the Db2-server runs on AIX/Linux/Windows/cloud x64. You only need the licence when the Db2-server runs on Z/OS native, or i-series.

For connecting python ibm_db to IBM i series (as400), the python ibm_db module can only work with the clidriver and requires a licence file. If you already connect to IBM i series (as400) using IBM i access client ODBC option, then sadly the currently shipping python ibm_db module cannot work with that odbc driver, although the pyodbc module is able to work with that odbc driver , with slightly reduced functionality. In that case you would remove the python ibm_db module and replace it with the pyodbc module.

For either clidriver or Data Server Client, that licence can be available either at the Db2-for-Z/OS end (ask your DBA about db2connectactivate), or more commonly at the workstation end, or (in larger companies) can be avoided by connecting indirectly via a Db2-connect gateway product available separately from IBM.

When applied directly at the workstation, the license is a small file (with the extension .lic) that you must copy into the license subdirectory of your CLIDRIVER installation (or your Data Server Client installation). The license is tied (i.e. it must match) to the Db2-for-Z/OS release, and the license file can have different names depending on which product is purchased from IBM.

To get a licence file, ask your DBA, or purchase it (a Db2-connect personal license) from IBM Passport Advantage or through your reseller, or copy it from another workstation that does not use the license file.

Upvotes: 2

Related Questions