|
1 | 1 | package com.clickhouse.jdbc; |
2 | 2 |
|
3 | 3 | import com.clickhouse.client.api.ClientConfigProperties; |
| 4 | +import com.clickhouse.client.api.Session; |
4 | 5 | import com.clickhouse.client.api.internal.ServerSettings; |
5 | 6 | import com.clickhouse.client.api.query.GenericRecord; |
6 | 7 | import com.clickhouse.data.ClickHouseVersion; |
@@ -758,7 +759,11 @@ public void testCancelQueryWithSession() throws Exception { |
758 | 759 | // "Session is locked by a concurrent client" (SESSION_IS_LOCKED). The KILL QUERY request issued by |
759 | 760 | // cancel() must not carry the session id of the query being cancelled. |
760 | 761 | String sessionId = "test-session-" + UUID.randomUUID(); |
761 | | - try (Connection conn = getJdbcConnection()) { |
| 762 | + Properties properties = new Properties(); |
| 763 | + Session session = new Session(); |
| 764 | + session.setSessionId(sessionId); |
| 765 | + session.applyTo(properties); |
| 766 | + try (Connection conn = getJdbcConnection(properties)) { |
762 | 767 | try (StatementImpl stmt = (StatementImpl) conn.createStatement()) { |
763 | 768 | stmt.getLocalSettings().setSessionId(sessionId); |
764 | 769 | stmt.setQueryTimeout(30); // safety net so a failed cancel cannot hang the test |
@@ -799,7 +804,12 @@ public void testCancelInsertWithSession() throws Exception { |
799 | 804 | // Regression test for #2690 covering a long-running INSERT executed inside a session. |
800 | 805 | String tableName = getDatabase() + ".cancel_insert_with_session"; |
801 | 806 | String sessionId = "test-session-" + UUID.randomUUID(); |
802 | | - try (Connection conn = getJdbcConnection(Map.of(ASYNC_INSERT_SETTING_KEY, ServerSettings.OFF))) { |
| 807 | + Properties properties = new Properties(); |
| 808 | + properties.put(ASYNC_INSERT_SETTING_KEY, ServerSettings.OFF); |
| 809 | + Session session = new Session(); |
| 810 | + session.setSessionId(sessionId); |
| 811 | + session.applyTo(properties); |
| 812 | + try (Connection conn = getJdbcConnection(properties)) { |
803 | 813 | try (Statement setup = conn.createStatement()) { |
804 | 814 | setup.execute("DROP TABLE IF EXISTS " + tableName); |
805 | 815 | setup.execute("CREATE TABLE " + tableName + " (num UInt64) ENGINE = MergeTree ORDER BY ()"); |
|
0 commit comments