9
9
import java .util .Properties ;
10
10
import java .util .UUID ;
11
11
12
+ import com .clickhouse .client .ClickHouseProtocol ;
13
+ import com .clickhouse .client .ClickHouseRequest ;
12
14
import com .clickhouse .client .config .ClickHouseClientOption ;
13
15
import com .clickhouse .data .ClickHouseCompression ;
14
16
import com .clickhouse .data .ClickHouseUtils ;
@@ -28,7 +30,15 @@ public ClickHouseConnection newConnection(Properties properties) throws SQLExcep
28
30
public void testCentralizedConfiguration () throws SQLException {
29
31
Properties props = new Properties ();
30
32
props .setProperty ("custom_settings" , "max_result_rows=1" );
31
- try (ClickHouseConnection conn = newConnection (props )) {
33
+ try (ClickHouseConnection conn = newConnection (props ); Statement stmt = conn .createStatement ()) {
34
+ // gRPC stopped working since 23.3 with below error:
35
+ // SQL Code: 649, DB::Exception: Transaction Control Language queries are
36
+ // allowed only inside session: while starting a transaction with
37
+ // 'implicit_transaction'
38
+ if (stmt .unwrap (ClickHouseRequest .class ).getServer ().getProtocol () == ClickHouseProtocol .GRPC ) {
39
+ throw new SkipException ("Skip the test as transaction is supported since 22.7" );
40
+ }
41
+
32
42
Assert .assertEquals (conn .getConfig ().getResponseCompressAlgorithm (), ClickHouseCompression .LZ4 );
33
43
Assert .assertTrue (conn .getJdbcConfig ().isAutoCommit ());
34
44
Assert .assertFalse (conn .getJdbcConfig ().isTransactionSupported ());
@@ -121,7 +131,12 @@ public void testAutoCommitMode() throws SQLException {
121
131
122
132
for (int i = 0 ; i < 10 ; i ++) {
123
133
try (ClickHouseConnection conn = newConnection (props ); Statement stmt = conn .createStatement ()) {
124
- if (!conn .getServerVersion ().check ("[22.7,)" )) {
134
+ if (!conn .getServerVersion ().check ("[22.7,)" )
135
+ // gRPC stopped working since 23.3 with below error:
136
+ // SQL Code: 649, DB::Exception: Transaction Control Language queries are
137
+ // allowed only inside session: while starting a transaction with
138
+ // 'implicit_transaction'
139
+ || stmt .unwrap (ClickHouseRequest .class ).getServer ().getProtocol () == ClickHouseProtocol .GRPC ) {
125
140
throw new SkipException ("Skip the test as transaction is supported since 22.7" );
126
141
}
127
142
stmt .execute ("select 1, throwIf(" + i + " % 3 = 0)" );
@@ -292,7 +307,12 @@ public void testAutoCommit() throws SQLException {
292
307
props .setProperty ("transactionSupport" , "true" );
293
308
String tableName = "test_jdbc_tx_auto_commit" ;
294
309
try (ClickHouseConnection c = newConnection (props ); Statement s = c .createStatement ()) {
295
- if (!c .getServerVersion ().check ("[22.7,)" )) {
310
+ if (!c .getServerVersion ().check ("[22.7,)" )
311
+ // gRPC stopped working since 23.3 with below error:
312
+ // SQL Code: 649, DB::Exception: Transaction Control Language queries are
313
+ // allowed only inside session: while starting a transaction with
314
+ // 'implicit_transaction'
315
+ || s .unwrap (ClickHouseRequest .class ).getServer ().getProtocol () == ClickHouseProtocol .GRPC ) {
296
316
throw new SkipException ("Skip the test as transaction is supported since 22.7" );
297
317
}
298
318
s .execute ("drop table if exists " + tableName + "; "
@@ -385,7 +405,12 @@ public void testManualTxApi() throws SQLException {
385
405
txProps .setProperty ("transactionSupport" , "true" );
386
406
String tableName = "test_jdbc_manual_tx_api" ;
387
407
try (ClickHouseConnection c = newConnection (txProps ); Statement s = c .createStatement ()) {
388
- if (!c .getServerVersion ().check ("[22.7,)" )) {
408
+ if (!c .getServerVersion ().check ("[22.7,)" )
409
+ // gRPC stopped working since 23.3 with below error:
410
+ // SQL Code: 649, DB::Exception: Transaction Control Language queries are
411
+ // allowed only inside session: while starting a transaction with
412
+ // 'implicit_transaction'
413
+ || s .unwrap (ClickHouseRequest .class ).getServer ().getProtocol () == ClickHouseProtocol .GRPC ) {
389
414
throw new SkipException ("Skip the test as transaction is supported since 22.7" );
390
415
}
391
416
s .execute ("drop table if exists " + tableName + "; "
@@ -496,7 +521,12 @@ public void testManualTxTcl() throws SQLException {
496
521
txProps .setProperty ("transactionSupport" , "true" );
497
522
String tableName = "test_jdbc_manual_tx_tcl" ;
498
523
try (ClickHouseConnection c = newConnection (txProps ); Statement s = c .createStatement ()) {
499
- if (!c .getServerVersion ().check ("[22.7,)" )) {
524
+ if (!c .getServerVersion ().check ("[22.7,)" )
525
+ // gRPC stopped working since 23.3 with below error:
526
+ // SQL Code: 649, DB::Exception: Transaction Control Language queries are
527
+ // allowed only inside session: while starting a transaction with
528
+ // 'implicit_transaction'
529
+ || s .unwrap (ClickHouseRequest .class ).getServer ().getProtocol () == ClickHouseProtocol .GRPC ) {
500
530
throw new SkipException ("Skip the test as transaction is supported since 22.7" );
501
531
}
502
532
s .execute ("drop table if exists " + tableName + "; "
0 commit comments