Skip to content

Commit

Permalink
Merge pull request #2146 from ClickHouse/fix_jdbc_tests_switching_db
Browse files Browse the repository at this point in the history
[jdbc-v2] fixed switching db test
  • Loading branch information
chernser authored Feb 13, 2025
2 parents e37c105 + 804dba1 commit 208d547
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2511,7 +2511,7 @@ public void testTransactionTimeout() throws ClickHouseException {

tx.begin();
try {
Thread.sleep(3000L);
Thread.sleep(4000L);
} catch (InterruptedException ex) {
Assert.fail("Sleep was interrupted", ex);
}
Expand Down
5 changes: 3 additions & 2 deletions jdbc-v2/src/test/java/com/clickhouse/jdbc/StatementTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -562,12 +562,13 @@ void testWithClause() throws Exception {

@Test(groups = { "integration" })
public void testSwitchDatabase() throws Exception {
String databaseName = getDatabase() + "_test_switch";
String createSql = "CREATE TABLE switchDatabaseWithUse (id UInt8, words String) ENGINE = MergeTree ORDER BY ()";
try (Connection conn = getJdbcConnection()) {
try (Statement stmt = conn.createStatement()) {
assertEquals(stmt.executeUpdate(createSql), 0);
assertEquals(stmt.executeUpdate("CREATE DATABASE \"newDatabase\" ENGINE=Atomic"), 0);
assertFalse(stmt.execute("USE \"newDatabase\""));
assertEquals(stmt.executeUpdate("CREATE DATABASE \"" + databaseName + "\""), 0);
assertFalse(stmt.execute("USE \"" + databaseName + "\""));
assertEquals(stmt.executeUpdate(createSql), 0);
}
}
Expand Down

0 comments on commit 208d547

Please sign in to comment.