diff --git a/.github/workflows/ci-4.x.yml b/.github/workflows/ci-4.x.yml index b5d752219..310452159 100644 --- a/.github/workflows/ci-4.x.yml +++ b/.github/workflows/ci-4.x.yml @@ -46,7 +46,6 @@ jobs: module: 'vertx-mssql-client' - os: ubuntu-latest jdk: 8 - profile: 'DB2-11.5' module: 'vertx-db2-client' - os: ubuntu-latest jdk: 8 diff --git a/.github/workflows/ci-matrix-5.x.yml b/.github/workflows/ci-matrix-5.x.yml index c878aafd1..722d3d913 100644 --- a/.github/workflows/ci-matrix-5.x.yml +++ b/.github/workflows/ci-matrix-5.x.yml @@ -53,7 +53,6 @@ jobs: module: 'vertx-mssql-client' - os: ubuntu-latest jdk: 11 - profile: 'DB2-11.5' module: 'vertx-db2-client' - os: ubuntu-latest jdk: 11 diff --git a/vertx-db2-client/pom.xml b/vertx-db2-client/pom.xml index 62b1f2a6b..d1e39e34e 100644 --- a/vertx-db2-client/pom.xml +++ b/vertx-db2-client/pom.xml @@ -49,16 +49,10 @@ org.testcontainers - testcontainers-db2 + testcontainers ${testcontainers.version} test - - com.ibm.db2 - jcc - 11.1.4.4 - test - org.slf4j diff --git a/vertx-db2-client/src/main/java/io/vertx/db2client/impl/DB2SocketConnection.java b/vertx-db2-client/src/main/java/io/vertx/db2client/impl/DB2SocketConnection.java index 766dfb5a7..854e72474 100644 --- a/vertx-db2-client/src/main/java/io/vertx/db2client/impl/DB2SocketConnection.java +++ b/vertx-db2-client/src/main/java/io/vertx/db2client/impl/DB2SocketConnection.java @@ -1,17 +1,12 @@ /* - * Copyright (C) 2019,2020 IBM Corporation + * Copyright (c) 2011-2026 Contributors to the Eclipse Foundation * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 */ package io.vertx.db2client.impl; @@ -24,23 +19,18 @@ import io.vertx.core.spi.metrics.ClientMetrics; import io.vertx.db2client.DB2ConnectOptions; import io.vertx.db2client.DB2Exception; -import io.vertx.db2client.impl.codec.ConnectionState; -import io.vertx.db2client.impl.codec.DB2CommandMessage; -import io.vertx.db2client.impl.codec.DB2Codec; -import io.vertx.db2client.impl.codec.DB2PreparedStatement; -import io.vertx.db2client.impl.codec.ExtendedBatchQueryDB2CommandMessage; -import io.vertx.db2client.impl.codec.ExtendedQueryDB2CommandMessage; +import io.vertx.db2client.impl.codec.*; import io.vertx.db2client.impl.command.InitialHandshakeCommand; import io.vertx.db2client.impl.drda.ConnectionMetaData; import io.vertx.db2client.impl.drda.SQLState; import io.vertx.db2client.impl.drda.SqlCode; import io.vertx.sqlclient.SqlConnectOptions; import io.vertx.sqlclient.codec.CommandMessage; -import io.vertx.sqlclient.spi.connection.Connection; +import io.vertx.sqlclient.codec.SocketConnectionBase; import io.vertx.sqlclient.internal.PreparedStatement; import io.vertx.sqlclient.internal.QueryResultHandler; -import io.vertx.sqlclient.codec.SocketConnectionBase; import io.vertx.sqlclient.spi.DatabaseMetadata; +import io.vertx.sqlclient.spi.connection.Connection; import io.vertx.sqlclient.spi.protocol.CommandBase; import io.vertx.sqlclient.spi.protocol.ExtendedQueryCommand; import io.vertx.sqlclient.spi.protocol.SimpleQueryCommand; @@ -141,7 +131,9 @@ protected void doSchedule(CommandBase cmd, Completable handler) { @Override public void handleClose(Throwable t) { super.handleClose(t); - context().runOnContext(closeHandler); + if (closeHandler != null) { + context().runOnContext(closeHandler); + } } @Override diff --git a/vertx-db2-client/src/test/java/io/vertx/tests/db2client/DB2DataTypeTest.java b/vertx-db2-client/src/test/java/io/vertx/tests/db2client/DB2DataTypeTest.java index c4861f886..9b0f62743 100644 --- a/vertx-db2-client/src/test/java/io/vertx/tests/db2client/DB2DataTypeTest.java +++ b/vertx-db2-client/src/test/java/io/vertx/tests/db2client/DB2DataTypeTest.java @@ -1,17 +1,12 @@ /* - * Copyright (C) 2020 IBM Corporation + * Copyright (c) 2011-2026 Contributors to the Eclipse Foundation * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 */ package io.vertx.tests.db2client; @@ -32,8 +27,6 @@ import java.util.List; import java.util.UUID; -import static org.junit.Assume.assumeTrue; - @RunWith(VertxUnitRunner.class) public class DB2DataTypeTest extends DB2TestBase { @@ -214,35 +207,6 @@ public void testUUID(TestContext ctx) { })); } - @Test - public void testRowId(TestContext ctx) { - assumeTrue("Only DB2/Z supports the ROWID column type", rule.isZOS()); - - final String msg = "insert data for testRowId"; - connect(ctx.asyncAssertSuccess(conn -> { - // Insert some data - conn - .preparedQuery("INSERT INTO ROWTEST (message) VALUES ('" + msg + "')") - .execute() - .onComplete(ctx.asyncAssertSuccess(insertResult -> { - // Find it by msg - conn - .preparedQuery("SELECT * FROM ROWTEST WHERE message = '" + msg + "'") - .execute() - .onComplete(ctx.asyncAssertSuccess(rows -> { - RowId rowId = verifyRowId(ctx, rows, msg); - // Now find it by rowid - conn - .preparedQuery("SELECT * FROM ROWTEST WHERE id = ?") - .execute(Tuple.of(rowId)) - .onComplete(ctx.asyncAssertSuccess(rows2 -> { - verifyRowId(ctx, rows2, msg); - })); - })); - })); - })); - } - /** * Test to support using enum string values in the Row and Tuple methods. */ diff --git a/vertx-db2-client/src/test/java/io/vertx/tests/db2client/QueryVariationsTest.java b/vertx-db2-client/src/test/java/io/vertx/tests/db2client/QueryVariationsTest.java index 2c5314b14..3fa8814ac 100644 --- a/vertx-db2-client/src/test/java/io/vertx/tests/db2client/QueryVariationsTest.java +++ b/vertx-db2-client/src/test/java/io/vertx/tests/db2client/QueryVariationsTest.java @@ -1,12 +1,15 @@ -package io.vertx.tests.db2client; - -import static org.junit.Assume.assumeFalse; - -import java.util.Arrays; -import java.util.function.Consumer; +/* + * Copyright (c) 2011-2026 Contributors to the Eclipse Foundation + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + */ -import org.junit.Test; -import org.junit.runner.RunWith; +package io.vertx.tests.db2client; import io.vertx.ext.unit.TestContext; import io.vertx.ext.unit.junit.VertxUnitRunner; @@ -14,6 +17,11 @@ import io.vertx.sqlclient.RowIterator; import io.vertx.sqlclient.RowSet; import io.vertx.sqlclient.Tuple; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.util.Arrays; +import java.util.function.Consumer; /** * Tests for subqueries which are documented here: @@ -180,8 +188,6 @@ public void testSectionReuse(TestContext ctx) { */ @Test public void testSequenceQuery(TestContext ctx) { - assumeFalse("TODO: Sequences behave differently on DB2/z and need to be implemented properly", rule.isZOS()); - connect(ctx.asyncAssertSuccess(con -> { con .query("values nextval for my_seq") @@ -214,8 +220,6 @@ public void testSequenceQuery(TestContext ctx) { */ @Test public void testSequenceQueryPrepared(TestContext ctx) { - assumeFalse("TODO: Sequences behave differently on DB2/z and need to be implemented properly", rule.isZOS()); - connect(ctx.asyncAssertSuccess(con -> { con .preparedQuery("VALUES nextval for my_seq") diff --git a/vertx-db2-client/src/test/java/io/vertx/tests/db2client/TableJoinTest.java b/vertx-db2-client/src/test/java/io/vertx/tests/db2client/TableJoinTest.java index 7db7723e6..4f9ff0bdc 100644 --- a/vertx-db2-client/src/test/java/io/vertx/tests/db2client/TableJoinTest.java +++ b/vertx-db2-client/src/test/java/io/vertx/tests/db2client/TableJoinTest.java @@ -1,15 +1,23 @@ -package io.vertx.tests.db2client; - -import static org.junit.Assume.assumeFalse; - -import java.util.Arrays; +/* + * Copyright (c) 2011-2026 Contributors to the Eclipse Foundation + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + */ -import org.junit.Test; -import org.junit.runner.RunWith; +package io.vertx.tests.db2client; import io.vertx.ext.unit.TestContext; import io.vertx.ext.unit.junit.VertxUnitRunner; import io.vertx.sqlclient.Row; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.util.Arrays; /** * Tests for table joins which are documented here: @@ -84,7 +92,6 @@ public void testRightOuterJoin(TestContext ctx) { @Test public void testFullOuterJoin(TestContext ctx) { - assumeFalse("DB2 on Z does not support operations within ON clause for FULL OUTER JOIN", rule.isZOS()); testJoin(ctx, "FULL OUTER JOIN"); } diff --git a/vertx-db2-client/src/test/java/io/vertx/tests/db2client/junit/DB2Resource.java b/vertx-db2-client/src/test/java/io/vertx/tests/db2client/junit/DB2Resource.java index 790c1aaf1..0afbb0f06 100644 --- a/vertx-db2-client/src/test/java/io/vertx/tests/db2client/junit/DB2Resource.java +++ b/vertx-db2-client/src/test/java/io/vertx/tests/db2client/junit/DB2Resource.java @@ -10,21 +10,18 @@ */ package io.vertx.tests.db2client.junit; +import com.github.dockerjava.api.model.Capability; +import io.netty.util.internal.PlatformDependent; import io.vertx.core.net.ClientSSLOptions; import io.vertx.core.net.JksOptions; import io.vertx.db2client.DB2ConnectOptions; import org.junit.rules.ExternalResource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.testcontainers.containers.Db2Container; +import org.testcontainers.containers.BindMode; +import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLSyntaxErrorException; import java.time.Duration; import java.util.Objects; @@ -34,29 +31,40 @@ public class DB2Resource extends ExternalResource { private static final boolean CUSTOM_DB2 = get("DB2_HOST") != null; - /** - * In order for this container to be reused across test runs you need to add the line: - * testcontainers.reuse.enable=true to your ~/.testcontainers.properties - * file (create it if it does not exist) - */ public static final DB2Resource SHARED_INSTANCE = new DB2Resource(); private boolean started = false; - private boolean isDb2OnZ = false; private DB2ConnectOptions options; - private final Db2Container instance = new Db2Container("ibmcom/db2:11.5.0.0a") - .acceptLicense() - .withLogConsumer(out -> logger.debug("[DB2] {}", out.getUtf8String())) - .withUsername("vertx") - .withPassword("vertx") - .withDatabaseName("vertx") + private final GenericContainer instance = new GenericContainer<>("icr.io/db2_community/db2:12.1.4.0") + .withCreateContainerCmdModifier(cmd -> cmd + .withCapAdd(Capability.IPC_LOCK) + .withCapAdd(Capability.IPC_OWNER)) + .withEnv("LICENSE", "accept") + .withEnv("DB2INSTANCE", "vertx") + .withEnv("DB2INST1_PASSWORD", "vertx") + .withEnv("DBNAME", "vertx") + .withEnv("BLU", "false") + .withEnv("ENABLE_ORACLE_COMPATIBILITY", "false") + .withEnv("UPDATEAVAIL", "NO") + .withEnv("TO_CREATE_SAMPLEDB", "false") + .withEnv("REPODB", "false") + .withEnv("IS_OSXFS", String.valueOf(PlatformDependent.isOsx())) + .withEnv("PERSISTENT_HOME", "true") + .withEnv("HADR_ENABLED", "false") + .withEnv("ETCD_ENDPOINT", "") + .withEnv("ETCD_USERNAME", "") + .withEnv("ETCD_PASSWORD", "") + .withEnv("AUTOCONFIG", "false") + .withEnv("ARCHIVE_LOGS", "false") .withExposedPorts(50000, 50001) - .withFileSystemBind("src/test/resources/tls/server/", "/certs/") - .withFileSystemBind("src/test/resources/tls/db2_tls_setup.sh", "/var/custom/db2_tls_setup.sh") + .withClasspathResourceMapping("tls/server/", "/certs/", BindMode.READ_ONLY) + .withClasspathResourceMapping("tls/01-db2_tls_setup.sh", "/var/custom/01-db2_tls_setup.sh", BindMode.READ_ONLY) + .withClasspathResourceMapping("init.sql", "/tmp/init.sql", BindMode.READ_ONLY) + .withClasspathResourceMapping("02-init-db.sh", "/var/custom/02-init-db.sh", BindMode.READ_ONLY) + .withLogConsumer(out -> logger.debug("[DB2] {}", out.getUtf8String())) .waitingFor(new LogMessageWaitStrategy() - .withRegEx(".*VERTX SSH SETUP DONE.*") - .withStartupTimeout(Duration.ofMinutes(10))) - .withReuse(true); + .withRegEx(".*DB2 DATABASE INITIALIZATION COMPLETE.*") + .withStartupTimeout(Duration.ofMinutes(10))); @Override protected void before() throws Throwable { @@ -68,9 +76,9 @@ protected void before() throws Throwable { options = new DB2ConnectOptions() .setHost(instance.getHost()) .setPort(instance.getMappedPort(50000)) - .setDatabase(instance.getDatabaseName()) - .setUser(instance.getUsername()) - .setPassword(instance.getPassword()); + .setDatabase("vertx") + .setUser("vertx") + .setPassword("vertx"); } else { logger.info("Using custom DB2 instance as requested via DB2_HOST={}", get("DB2_HOST")); Objects.requireNonNull(get("DB2_PORT"), "Must set DB2_PORT to a non-null value if DB2_HOST is set"); @@ -83,11 +91,7 @@ protected void before() throws Throwable { .setDatabase(get("DB2_NAME")) .setUser(get("DB2_USER")) .setPassword(get("DB2_PASS")); - } - String jdbcUrl = "jdbc:db2://" + options.getHost() + ":" + options.getPort() + "/" + options.getDatabase(); - logger.info("Initializing DB2 database at: {}", jdbcUrl); - try (Connection con = DriverManager.getConnection(jdbcUrl, options.getUser(), options.getPassword())) { - runInitSql(con); + logger.info("Custom DB2 instance must be manually initialized with init.sql"); } started = true; } @@ -106,40 +110,8 @@ public DB2ConnectOptions secureOptions() { .setPassword("db2test"))); } - public boolean isZOS() { - return isDb2OnZ; - } - private static String get(String name) { return System.getProperty(name, System.getenv(name)); } - private void runInitSql(Connection con) throws Exception { - isDb2OnZ = con.getMetaData().getDatabaseProductVersion().startsWith("DSN"); - String currentLine = ""; - Path initScript = Paths.get("src", "test", "resources", isDb2OnZ ? "init.zos.sql" : "init.sql"); - logger.info("Running init script at: {}", initScript); - for (String sql : Files.readAllLines(initScript)) { - if (sql.startsWith("--")) - continue; - currentLine += sql; - if (sql.endsWith(";")) { - logger.debug(" {}", currentLine); - try { - con.createStatement().execute(currentLine); - } catch (SQLSyntaxErrorException e) { - if (sql.startsWith("DROP ") && e.getErrorCode() == -204) { - logger.debug(" ignoring syntax exception: {}", e.getMessage()); - } else { - throw e; - } - } - currentLine = ""; - } - } - if (!currentLine.isEmpty()) { - throw new IllegalStateException("Dangling SQL on init script. Ensure all statements are terminated with ';' char. SQL: " + currentLine); - } - } - } diff --git a/vertx-db2-client/src/test/java/io/vertx/tests/db2client/tck/DB2BinaryDataTypeDecodeTest.java b/vertx-db2-client/src/test/java/io/vertx/tests/db2client/tck/DB2BinaryDataTypeDecodeTest.java index 78eeeb709..fd0225723 100644 --- a/vertx-db2-client/src/test/java/io/vertx/tests/db2client/tck/DB2BinaryDataTypeDecodeTest.java +++ b/vertx-db2-client/src/test/java/io/vertx/tests/db2client/tck/DB2BinaryDataTypeDecodeTest.java @@ -27,8 +27,6 @@ import java.sql.JDBCType; import java.time.LocalTime; -import static org.junit.Assume.assumeFalse; - @RunWith(VertxUnitRunner.class) public class DB2BinaryDataTypeDecodeTest extends BinaryDataTypeDecodeTestBase { @@ -89,18 +87,6 @@ public void testBoolean(TestContext ctx) { })); } - @Test - @Override - public void testDouble(TestContext ctx) { - if (!rule.isZOS()) { - super.testDouble(ctx); - return; - } - - // For DB2/z the largest value that can be stored in a DOUBLE column is 7.2E75 - testDecodeGeneric(ctx, "test_float_8", Double.class, JDBCType.DOUBLE, (double) 7.2E75); - } - @Override public void testChar(TestContext ctx) { // Override to expecting JDBCType.CHAR instead of VARCHAR @@ -113,13 +99,6 @@ public void testTime(TestContext ctx) { testDecodeGeneric(ctx, "test_time", LocalTime.class, JDBCType.TIME, LocalTime.of(18, 45, 2)); } - @Test - @Override - public void testSelectAll(TestContext ctx) { - assumeFalse(rule.isZOS()); - super.testSelectAll(ctx); - } - @Test @Ignore @Override diff --git a/vertx-db2-client/src/test/java/io/vertx/tests/db2client/tck/DB2ConnectionTest.java b/vertx-db2-client/src/test/java/io/vertx/tests/db2client/tck/DB2ConnectionTest.java index 11840f520..6fac5b2ff 100644 --- a/vertx-db2-client/src/test/java/io/vertx/tests/db2client/tck/DB2ConnectionTest.java +++ b/vertx-db2-client/src/test/java/io/vertx/tests/db2client/tck/DB2ConnectionTest.java @@ -85,8 +85,8 @@ public void testConnectInvalidDatabase(TestContext ctx) { @Override protected void validateDatabaseMetaData(TestContext ctx, DatabaseMetadata md) { - ctx.assertEquals(11, md.majorVersion()); - ctx.assertEquals(5, md.minorVersion()); + ctx.assertTrue(md.majorVersion() > 0); + ctx.assertTrue(md.minorVersion() > 0); ctx.assertTrue(md.productName().contains("DB2")); } } diff --git a/vertx-db2-client/src/test/java/io/vertx/tests/db2client/tck/DB2TextDataTypeDecodeTest.java b/vertx-db2-client/src/test/java/io/vertx/tests/db2client/tck/DB2TextDataTypeDecodeTest.java index a546c8512..521903e5d 100644 --- a/vertx-db2-client/src/test/java/io/vertx/tests/db2client/tck/DB2TextDataTypeDecodeTest.java +++ b/vertx-db2-client/src/test/java/io/vertx/tests/db2client/tck/DB2TextDataTypeDecodeTest.java @@ -89,17 +89,4 @@ public void testBoolean(TestContext ctx) { })); })); } - - @Test - @Override - public void testDouble(TestContext ctx) { - if (!rule.isZOS()) { - super.testDouble(ctx); - return; - } - - // For DB2/z the largest value that can be stored in a DOUBLE column is 7.2E75 - testDecodeGeneric(ctx, "test_float_8", Double.class, (double) 7.2E75); - } - } diff --git a/vertx-db2-client/src/test/java/io/vertx/tests/db2client/tck/DB2TransactionTest.java b/vertx-db2-client/src/test/java/io/vertx/tests/db2client/tck/DB2TransactionTest.java index b407ef182..5383511db 100644 --- a/vertx-db2-client/src/test/java/io/vertx/tests/db2client/tck/DB2TransactionTest.java +++ b/vertx-db2-client/src/test/java/io/vertx/tests/db2client/tck/DB2TransactionTest.java @@ -21,14 +21,11 @@ import org.junit.Before; import org.junit.ClassRule; import org.junit.Rule; -import org.junit.Test; import org.junit.rules.TestName; import org.junit.runner.RunWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static org.junit.Assume.assumeFalse; - @RunWith(VertxUnitRunner.class) public class DB2TransactionTest extends TransactionTestBase { @@ -76,17 +73,4 @@ protected void cleanTestTable(TestContext ctx) { protected String statement(String... parts) { return String.join("?", parts); } - - @Test - public void testDelayedCommit(TestContext ctx) { - assumeFalse("DB2 on Z holds write locks on inserted columns with isolation level = 2", rule.isZOS()); - super.testDelayedCommit(ctx); - } - - @Test - public void testFailureWithPendingQueries(TestContext ctx) { - assumeFalse("DB2 on Z holds write locks on inserted columns with isolation level = 2", rule.isZOS()); - super.testDelayedCommit(ctx); - } - } diff --git a/vertx-db2-client/src/test/resources/02-init-db.sh b/vertx-db2-client/src/test/resources/02-init-db.sh new file mode 100755 index 000000000..0f7ad7d3d --- /dev/null +++ b/vertx-db2-client/src/test/resources/02-init-db.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# +# Copyright (c) 2011-2026 Contributors to the Eclipse Foundation +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License 2.0 which is available at +# http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 +# which is available at https://www.apache.org/licenses/LICENSE-2.0. +# +# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +# + +set -e + +echo "BEGIN DB2 DATABASE INITIALIZATION" + +su - ${DB2INSTANCE} -c "db2 force applications all; sleep 5; echo '--- Connecting ---'; db2 connect to ${DBNAME}; echo '--- Running SQL ---'; db2 -tvf /tmp/init.sql; echo '--- Finished SQL ---'" + +echo "DB2 DATABASE INITIALIZATION COMPLETE" diff --git a/vertx-db2-client/src/test/resources/init.zos.sql b/vertx-db2-client/src/test/resources/init.zos.sql deleted file mode 100644 index cc2342526..000000000 --- a/vertx-db2-client/src/test/resources/init.zos.sql +++ /dev/null @@ -1,134 +0,0 @@ --- See this page for a cross-platform SQL reference: --- https://community.ibm.com/community/user/hybriddatamanagement/blogs/lynn-chou/2018/10/01/the-sql-reference-for-cross-platform-development --- --- Fortune table -- --- used by TCK -DROP TABLE Fortune; -CREATE TABLE Fortune ( - id integer NOT NULL GENERATED AS IDENTITY (START WITH 1, INCREMENT BY 1), - message varchar(2048), - PRIMARY KEY (id) -); -INSERT INTO Fortune (message) VALUES ('fortune: No such file or directory'); -INSERT INTO Fortune (message) VALUES ('A computer scientist is someone who fixes things that aren''t broken.'); -INSERT INTO Fortune (message) VALUES ('After enough decimal places, nobody gives a damn.'); -INSERT INTO Fortune (message) VALUES ('A bad random number generator: 1, 1, 1, 1, 1, 4.33e+67, 1, 1, 1'); -INSERT INTO Fortune (message) VALUES ('A computer program does what you tell it to do, not what you want it to do.'); -INSERT INTO Fortune (message) VALUES ('Emacs is a nice operating system, but I prefer UNIX. — Tom Christaensen'); -INSERT INTO Fortune (message) VALUES ('Any program that runs right is obsolete.'); -INSERT INTO Fortune (message) VALUES ('A list is only as strong as its weakest link. — Donald Knuth'); -INSERT INTO Fortune (message) VALUES ('Feature: A bug with seniority.'); -INSERT INTO Fortune (message) VALUES ('Computers make very fast, very accurate mistakes.'); -INSERT INTO Fortune (message) VALUES (''); -INSERT INTO Fortune (message) VALUES ('フレームワークのベンチマーク'); - --- immutable table for select query testing -- --- used by TCK -DROP TABLE immutable; -CREATE TABLE immutable -( - id integer NOT NULL, - message varchar(2048) NOT NULL, - PRIMARY KEY (id) -); -INSERT INTO immutable (id, message) VALUES (1, 'fortune: No such file or directory'); -INSERT INTO immutable (id, message) VALUES (2, 'A computer scientist is someone who fixes things that aren''t broken.'); -INSERT INTO immutable (id, message) VALUES (3, 'After enough decimal places, nobody gives a damn.'); -INSERT INTO immutable (id, message) VALUES (4, 'A bad random number generator: 1, 1, 1, 1, 1, 4.33e+67, 1, 1, 1'); -INSERT INTO immutable (id, message) VALUES (5, 'A computer program does what you tell it to do, not what you want it to do.'); -INSERT INTO immutable (id, message) VALUES (6, 'Emacs is a nice operating system, but I prefer UNIX. — Tom Christaensen'); -INSERT INTO immutable (id, message) VALUES (7, 'Any program that runs right is obsolete.'); -INSERT INTO immutable (id, message) VALUES (8, 'A list is only as strong as its weakest link. — Donald Knuth'); -INSERT INTO immutable (id, message) VALUES (9, 'Feature: A bug with seniority.'); -INSERT INTO immutable (id, message) VALUES (10, 'Computers make very fast, very accurate mistakes.'); -INSERT INTO immutable (id, message) VALUES (11, ''); -INSERT INTO immutable (id, message) VALUES (12, 'フレームワークのベンチマーク'); - --- mutable for insert,update,delete query testing -- --- used by TCK -DROP TABLE mutable; -CREATE TABLE mutable -( - id integer NOT NULL, - val varchar(2048) NOT NULL, - PRIMARY KEY (id) -); - --- basic data type table -- --- used by TCK -DROP TABLE basicdatatype; -CREATE TABLE basicdatatype -( - id INTEGER, - test_int_2 SMALLINT, - test_int_4 INTEGER, - test_int_8 BIGINT, - test_float_4 REAL, - test_float_8 DOUBLE, - test_numeric NUMERIC(5, 2), - test_decimal DECIMAL, - test_boolean SMALLINT, - test_char CHAR(8), - test_varchar VARCHAR(20), - test_date DATE, - test_time TIME -); -INSERT INTO basicdatatype(id, test_int_2, test_int_4, test_int_8, - test_float_4, test_float_8, test_numeric, test_decimal, - test_boolean, test_char, test_varchar, - test_date, test_time) -VALUES (1, 32767, 2147483647, 9223372036854775807, - 3.40282E38, 7.2E75, 999.99, 12345, - 1, 'testchar', 'testvarchar', - '2019-01-01', '18:45:02'); -INSERT INTO basicdatatype(id, test_int_2, test_int_4, test_int_8, - test_float_4, test_float_8, test_numeric, test_decimal, - test_boolean, test_char, test_varchar, - test_date, test_time) -VALUES (2, 32767, 2147483647, 9223372036854775807, - 3.40282E38, 7.2E75, 999.99, 12345, - 1, 'testchar', 'testvarchar', - '2019-01-01', '18:45:02'); -INSERT INTO basicdatatype(id, test_int_2, test_int_4, test_int_8, test_float_4, test_float_8, test_numeric, test_decimal, test_boolean, test_char, test_varchar, test_date, test_time) -VALUES (3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - --- Collector API testing -- --- used by TCK -DROP TABLE collector_test; -CREATE TABLE collector_test -( - id INT, - test_int_2 SMALLINT, - test_int_4 INT, - test_int_8 BIGINT, - test_float FLOAT, - test_double DOUBLE, - test_varchar VARCHAR(20) -); -INSERT INTO collector_test VALUES (1, 32767, 2147483647, 9223372036854775807, 123.456, 1.234567, 'HELLO,WORLD'); -INSERT INTO collector_test VALUES (2, 32767, 2147483647, 9223372036854775807, 123.456, 1.234567, 'hello,world'); - --- used by DB2DataTypeTest -- -DROP TABLE ROWTEST; -CREATE TABLE ROWTEST( - id ROWID NOT NULL GENERATED ALWAYS, - message varchar(1024) -); - --- used by DB2DataTypeTest -DROP TABLE db2_types; -CREATE TABLE db2_types -( - id INT, - test_byte SMALLINT, - test_float FLOAT, - test_bytes CHAR(255) for bit data, - test_vbytes VARCHAR(255) for bit data, - test_tstamp TIMESTAMP, - test_vchar VARCHAR(255), - test_int INT -); - --- Sequence used by QueryVariationsTest -DROP SEQUENCE my_seq; -CREATE SEQUENCE my_seq INCREMENT BY 1 START WITH 1; diff --git a/vertx-db2-client/src/test/resources/tls/01-db2_tls_setup.sh b/vertx-db2-client/src/test/resources/tls/01-db2_tls_setup.sh new file mode 100755 index 000000000..d7168fa40 --- /dev/null +++ b/vertx-db2-client/src/test/resources/tls/01-db2_tls_setup.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# +# Copyright (c) 2011-2026 Contributors to the Eclipse Foundation +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License 2.0 which is available at +# http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 +# which is available at https://www.apache.org/licenses/LICENSE-2.0. +# +# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +# + +echo "BEGIN SSH SETUP" + +su - ${DB2INSTANCE} -c "db2 update dbm cfg using DIAGLEVEL 2" +su - ${DB2INSTANCE} -c "db2 update dbm cfg using SSL_SVR_KEYDB /certs/server.kdb" +su - ${DB2INSTANCE} -c "db2 update dbm cfg using SSL_SVR_STASH /certs/server.sth" +su - ${DB2INSTANCE} -c "db2 update dbm cfg using SSL_SVR_LABEL mylabel" +su - ${DB2INSTANCE} -c "db2 update dbm cfg using ssl_svcename 50001" +su - ${DB2INSTANCE} -c "db2set -i vertx DB2COMM=SSL,TCPIP" +su - ${DB2INSTANCE} -c "db2stop" +su - ${DB2INSTANCE} -c "db2start" + +echo "VERTX SSH SETUP DONE" diff --git a/vertx-db2-client/src/test/resources/tls/db2_tls_setup.sh b/vertx-db2-client/src/test/resources/tls/db2_tls_setup.sh deleted file mode 100755 index 3718e7279..000000000 --- a/vertx-db2-client/src/test/resources/tls/db2_tls_setup.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -echo "BEGIN SSH SETUP" -export PATH=/opt/ibm/db2/V11.5/bin/:$PATH - -su - vertx -c 'db2 update dbm cfg using DIAGLEVEL 2' -su - vertx -c 'db2 update dbm cfg using SSL_SVR_KEYDB /certs/server.kdb' -su - vertx -c 'db2 update dbm cfg using SSL_SVR_STASH /certs/server.sth' -su - vertx -c 'db2 update dbm cfg using SSL_SVR_LABEL mylabel' -su - vertx -c 'db2 update dbm cfg using ssl_svcename 50001' -su - vertx -c 'db2set -i vertx DB2COMM=SSL,TCPIP' -su - vertx -c 'db2stop' -su - vertx -c 'db2start' - -echo "VERTX SSH SETUP DONE" \ No newline at end of file