从 Windows 连接到 z/OS 上的 Db2。由于许可证错误,连接失败

问题描述 投票:0回答:1

我已在 Windows 中安装了 Db2 Connect 并且成功加载了许可证:

Product name:                     "DB2 Connect Enterprise Edition"
License type:                     "Client Device"
Expiry date:                      "Permanent"
Product identifier:               "db2consv"
Version information:              "11.1"

当我尝试使用 JDBC 连接时,它表明存在许可证错误:

java -cp %CLASSPATH%;./db2jcc.jar com.ibm.db2.jcc.DB2Jcc -url jdbc:db2://xx.yy.zz.pp:port/DB -user USER -password PASSWORD -db2ConnectVersion "C:\Program Files\IBM\SQLLIB\java\db2jcc_license_cu.jar"


[jcc][10521][13706]Command : java com.ibm.db2.jcc.DB2Jcc -url jdbc:db2://xx.yy.zz.pp:port/DB -user USER -password ******** -db2ConnectVersion C:\Program Files\IBM\SQLLIB\java\db2jcc_license_cu.jar


DB2 V11.1
[jcc][10512][13714]Failed to create connection.
  SQLCODE: -4230
  SQLSTATE: 42968
  Message: [jcc][t4][10509][13454][3.72.54] Connection to the data server failed. The IBM Data Server for JDBC and SQLJ license was invalid
or was not activated for the DB2 for z/OS subsystem. If you are connecting directly to
the data server and using DB2 Connect Unlimited Edition for System z, perform the
activation step by running the activation program in the license activation kit.
If you are using any other edition of DB2 Connect, obtain the license file,
db2jcc_license_cisuz.jar, from the license activation kit, and follow the installation
directions to include the license file in the class path. ERRORCODE=-4230, SQLSTATE=42968

有人可以帮助我吗?

java db2 mainframe zos db2-zos
1个回答
1
投票

问题是 Db2 JDBC 驱动程序需要许可证文件。您需要在当前未执行的类路径上提供此内容。

您原来的命令是:

java -cp %CLASSPATH%;./db2jcc.jar com.ibm.db2.jcc.DB2Jcc -url jdbc:db2://xx.yy.zz.pp:port/DB -user USER -password PASSWORD -db2ConnectVersion "C:\Program Files\IBM\SQLLIB\java\db2jcc_license_cu.jar"

更改为:

java -cp %CLASSPATH%;C:\Program Files\IBM\SQLLIB\java\db2jcc_license_cu.jar;./db2jcc.jar com.ibm.db2.jcc.DB2Jcc -url jdbc:db2://xx.yy.zz.pp:port/DB -user USER -password PASSWORD -db2ConnectVersion "C:\Program Files\IBM\SQLLIB\java\db2jcc_license_cu.jar"

查看 IBM 的这篇文章,了解如何使用 Db2 许可证文件

另外,您可以查看这个 Stack Overflow 问题 我在哪里可以获得这两个 jar - db2jcc4_license_cu 和 db2jcc4_license_cisuz?

© www.soinside.com 2019 - 2024. All rights reserved.