液化Db2配置

液化Db2配置,db2,liquibase,Db2,Liquibase,我正试图让ubuntu上的liquibase 3.10.2首次使用Db2仓库。 在教程示例之后,H2“liquibase update”示例运行良好 使用下面指定的JAR和url字符串,可以很好地处理dbeaver,但将其转换为liquibase会产生以下错误 driver: com.ibm.db2.jcc.DB2Driver #jars in /test1/sql classpath: db2jcc4.jar:db2jcc_license_cu.jar databaseClass: com.

我正试图让ubuntu上的liquibase 3.10.2首次使用Db2仓库。 在教程示例之后,H2“liquibase update”示例运行良好

使用下面指定的JAR和url字符串,可以很好地处理dbeaver,但将其转换为liquibase会产生以下错误

driver: com.ibm.db2.jcc.DB2Driver 
#jars in /test1/sql
classpath: db2jcc4.jar:db2jcc_license_cu.jar
databaseClass: com.ibm.db2.jcc.DB2Driver

# Enter the path for your changelog file.
changeLogFile: samplechangelog.h2.sql

#### Enter the Target database 'url' information  ####
url: jdbc:db2://192.168.72.143:50000/bludb

# Enter the username for your Target database.
username: bluadmin

# Enter the password for your Target database.
password: bluadmin

#### Enter the Source Database 'referenceUrl' information ####
## The source database is the baseline or reference against which your target database is compared for diff/diffchangelog commands.

# Enter URL for the source database
referenceUrl: jdbc:db2://192.168.72.143:50000/bludb

# Enter the username for your source database
referenceUsername: bluadmin

# Enter the password for your source database
referencePassword: bluadmin


09:23:16.261 ERROR [liquibase.integration.commandline.Main]: Unexpected error running Liquibase: java.lang.ClassCastException: class com.ibm.db2.jcc.DB2Driver cannot be cast to class liquibase.database.Database (com.ibm.db2.jcc.DB2Driver is in unnamed module of loader java.net.URLClassLoader @242aa8d9; liquibase.database.Database is in unnamed module of loader 'app')
liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: java.lang.ClassCastException: class com.ibm.db2.jcc.DB2Driver cannot be cast to class liquibase.database.Database (com.ibm.db2.jcc.DB2Driver is in unnamed module of loader java.net.URLClassLoader @242aa8d9; liquibase.database.Database is in unnamed module of loader 'app')
    at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:125)
    at liquibase.integration.commandline.Main.doMigration(Main.java:1341)
    at liquibase.integration.commandline.Main.run(Main.java:303)
    at liquibase.integration.commandline.Main.main(Main.java:159)
Caused by: liquibase.exception.DatabaseException: java.lang.ClassCastException: class com.ibm.db2.jcc.DB2Driver cannot be cast to class liquibase.database.Database (com.ibm.db2.jcc.DB2Driver is in unnamed module of loader java.net.URLClassLoader @242aa8d9; liquibase.database.Database is in unnamed module of loader 'app')
    at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:259)
    at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:149)
    at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:90)
    ... 3 common frames omitted
Caused by: java.lang.ClassCastException: class com.ibm.db2.jcc.DB2Driver cannot be cast to class liquibase.database.Database (com.ibm.db2.jcc.DB2Driver is in unnamed module of loader java.net.URLClassLoader @242aa8d9; liquibase.database.Database is in unnamed module of loader 'app')
    at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:187)
    ... 5 common frames omitted
更新的其他信息:

(1) 导致显示错误的完整命令行是什么? 我正在发布h2教程中引用的简单示例

jarrod@ubuntu:~/liquibase3.10.2/test1/sql$ ls -al
total 6424
drwxrwxr-x 2 jarrod jarrod    4096 Aug  1 08:50 .
drwxrwxr-x 4 jarrod jarrod    4096 Aug  1 08:50 ..
-rw-r--r-- 1 jarrod jarrod     218 Jul 14 05:49 blankchangelog.h2.sql
-r--r--r-- 1 jarrod jarrod 6550443 Jun 11  2019 db2jcc4.jar
-r--r--r-- 1 jarrod jarrod    1529 Jun 11  2019 db2jcc_license_cu.jar
-rw-r--r-- 1 jarrod jarrod    2678 Aug  1 09:23 liquibase.properties
-rw-r--r-- 1 jarrod jarrod     456 Jul 14 05:49 samplechangelog.h2.sql
jarrod@ubuntu:~/liquibase3.10.2/test1/sql$ liquibase update 
15:05:37.848 DEBUG [liquibase.resource.ClassLoaderResourceAccessor]: Opening jar:file:/home/jarrod/liquibase3.10.2/liquibase.jar!/liquibase.build.properties as liquibase.build.properties
15:05:37.868 INFO  [liquibase.integration.commandline.Main]: ####################################################
##   _     _             _ _                      ##
....
(2) 更改日志文件的内容是什么 这与样本h2变化日志相同;没有变化

jarrod@ubuntu:~/liquibase3.10.2/test1/sql$ cat samplechangelog.h2.sql 
--liquibase formatted sql

--changeset your.name:1
create table person (
    id int primary key,
    name varchar(50) not null,
    address1 varchar(50),
    address2 varchar(50),
    city varchar(30)
)

--changeset your.name:2
create table company (
    id int primary key,
    name varchar(50) not null,
    address1 varchar(50),
    address2 varchar(50),
    city varchar(30)
)

--changeset other.dev:3
alter table person add column country varchar(2)

jarrod@ubuntu:~/liquibase3.10.2/test1/sql$ 
(3) 您使用的是哪个Db2驱动程序版本

捆绑包名称:IBM JCC JDBC 4驱动程序

(4) 什么确切的查询在dbeaver中工作,但在liquibase中失败

目前没有,只是想让连接正常工作。 我在Dbeaver中有一个工作连接,使用相同的jdbc驱动程序、相同的类名、相同的服务器、数据库、用户名、密码和URL模板


我真的很高兴看到SQL错误

对于我来说,liquibase 3.10.2似乎可以与DB2LUW一起工作

尝试进行这些更改,这些更改记录在文本文件
GETTING_STARTED.txt

将DB2JAR文件移动到liquibase的
lib
子目录中,或者安排对liquibase使用的类路径进行更改。对于DB2LUW,文件是:
lib/db2jcc4.jar、lib/db2jcc.jar、lib/db2jcc_license_cu.jar
。您的问题显示您将这些文件复制到了liquibase目录,而不是liquibase lib子目录


DB2LUW将拒绝H2的示例changeLogFile中的语法,因为DB2LUW要求主键列不为null。在示例文件中,您可以将所有表的
id int主键
更改为
id int not null主键
,以避免出现SQLCODE-542。

请编辑您的问题以添加缺少的事实(1)导致显示错误的完整命令行是什么?(2) 您使用的Db2驱动程序版本的更改日志文件内容(3)是什么?(4) 什么确切的查询在dbeaver中有效,但在liquibase中失败?感谢您的关注。我已经更新了原来的帖子。谢谢。我将jar移动到/lib,并从属性文件中删除了类内容。也许有点超前了!再次感谢。