File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
main/java/com/clickhouse/jdbc
test/java/com/clickhouse/jdbc Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -55,12 +55,15 @@ public boolean isV2(String url) {
5555 return false ;
5656 }
5757
58- if (url != null && url .contains ("clickhouse.jdbc.v1 " )) {
58+ if (url != null && url .contains ("clickhouse.jdbc.v " )) {
5959 urlFlagSent = true ;
6060
6161 if (url .contains ("clickhouse.jdbc.v1=true" )) {
6262 log .info ("V1 driver is requested through URL." );
6363 return false ;
64+ } if (url .contains ("clickhouse.jdbc.v2=false" )) {
65+ log .info ("V1 driver is requested through URL." );
66+ return false ;
6467 } else {
6568 log .info ("V2 driver is requested through URL." );
6669 return true ;
Original file line number Diff line number Diff line change @@ -28,4 +28,16 @@ public void testConnect() throws SQLException {
2828 Connection conn = driver .connect ("jdbc:clickhouse://" + address , null );
2929 conn .close ();
3030 }
31+ @ Test (groups = "integration" )
32+ public void testV2Driver () {
33+ ClickHouseDriver driver = new ClickHouseDriver ();
34+ Boolean V1 = false ;
35+ Boolean V2 = true ;
36+ Assert .assertEquals (driver .isV2 ("jdbc:clickhouse://localhost:8123" ), V2 );
37+ Assert .assertEquals (driver .isV2 ("jdbc:clickhouse://localhost:8123?clickhouse.jdbc.v1=true" ), V1 );
38+ Assert .assertEquals (driver .isV2 ("jdbc:clickhouse://localhost:8123?clickhouse.jdbc.v1=false" ), V2 );
39+ Assert .assertEquals (driver .isV2 ("jdbc:clickhouse://localhost:8123?clickhouse.jdbc.v2=true" ), V2 );
40+ Assert .assertEquals (driver .isV2 ("jdbc:clickhouse://localhost:8123?clickhouse.jdbc.v2=false" ), V1 );
41+
42+ }
3143}
You can’t perform that action at this time.
0 commit comments