Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
laglangyue committed Oct 21, 2022
1 parent 62da6e1 commit 330646d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public SeaTunnelDataType<?> mapping(ResultSetMetaData metadata, int colIndex) th
default:
final String jdbcColumnName = metadata.getColumnName(colIndex);
throw new UnsupportedOperationException(
String.format("Doesn't support DM2 type '%s' on column '%s' yet.", columnType, jdbcColumnName));
String.format("Doesn't support DB2 type '%s' on column '%s' yet.", columnType, jdbcColumnName));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private void initializeJdbcTable() {

private void assertHasData(String table) {
try (Statement statement = jdbcConnection.createStatement()) {
String sql = String.format("select * from \"%s\".%s", db2.getUsername(), table);
String sql = String.format("select * from \"%s\".%s", USER, table);
ResultSet source = statement.executeQuery(sql);
Assertions.assertTrue(source.next(), "result is null when sql is " + sql);
} catch (SQLException e) {
Expand All @@ -141,8 +141,8 @@ public void testJdbcSourceAndSink(TestContainer container) throws IOException, I
Container.ExecResult execResult = container.executeJob("/jdbc_db2_source_and_sink.conf");
Assertions.assertEquals(0, execResult.getExitCode());
assertHasData(SINK_TABLE);
JdbcCompareUtil.compare(jdbcConnection, String.format("select * from \"%s\".%s", db2.getUsername(), SOURCE_TABLE),
String.format("select * from \"%s\".%s", db2.getUsername(), SINK_TABLE),
JdbcCompareUtil.compare(jdbcConnection, String.format("select * from \"%s\".%s", USER, SOURCE_TABLE),
String.format("select * from \"%s\".%s", USER, SINK_TABLE),
"COL_BOOLEAN, COL_INT, COL_INTEGER, COL_SMALLINT, COL_BIGINT, COL_DECIMAL, COL_DEC," +
"COL_NUMERIC, COL_NUMBER, COL_REAL, COL_FLOAT,COL_DOUBLE_PRECISION, COL_DOUBLE, COL_DECFLOAT, COL_CHAR, COL_VARCHAR," +
"COL_LONG_VARCHAR, COL_GRAPHIC, COL_VARGRAPHIC, COL_LONG_VARGRAPHIC");
Expand All @@ -152,9 +152,10 @@ public void testJdbcSourceAndSink(TestContainer container) throws IOException, I

private void clearSinkTable() {
try (Statement statement = jdbcConnection.createStatement()) {
statement.execute(String.format("TRUNCATE TABLE %s.%s", DATABASE, SINK_TABLE));
String truncate = String.format("delete from \"%s\".%s where 1=1;", USER, SINK_TABLE);
statement.execute(truncate);
} catch (SQLException e) {
throw new RuntimeException("test dm server image error", e);
throw new RuntimeException("test db2 server image error", e);
}
}
}

0 comments on commit 330646d

Please sign in to comment.