Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package com.clickhouse.jdbc;

import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import java.sql.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;

import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertThrows;

Check warning on line 14 in clickhouse-jdbc/src/test/java/com/clickhouse/jdbc/GenericJDBCTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused import 'org.testng.Assert.assertThrows'.

See more on https://sonarcloud.io/project/issues?id=ClickHouse_clickhouse-java&issues=AZ15WtCHFHYCZi2aEN59&open=AZ15WtCHFHYCZi2aEN59&pullRequest=2821

@Test(groups = { "integration" })
public class GenericJDBCTest extends JdbcIntegrationTest {
Expand All @@ -33,7 +37,7 @@
properties.setProperty("user", "default");
properties.setProperty("password", "FAKE123456FAKE");

assertThrows(SQLException.class, () -> getConnection(properties));
assertFalse(getConnection(properties).isValid(10));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,17 @@
String pathWithoutLeadingSlash = rawPath.startsWith("/") ? rawPath.substring(1) : rawPath;
int lastSlashIndex = pathWithoutLeadingSlash.lastIndexOf('/');

String pathToDecode;
if (lastSlashIndex > 0) {
httpPath = "/" + pathWithoutLeadingSlash.substring(0, lastSlashIndex);
database = URLDecoder.decode(pathWithoutLeadingSlash.substring(lastSlashIndex + 1), StandardCharsets.UTF_8);
pathToDecode = pathWithoutLeadingSlash.substring(lastSlashIndex + 1);
} else {
// No slash found (lastSlashIndex == -1), so it's a single segment representing the database name.
// Example: "mydb" -> httpPath="", database="mydb"
database = URLDecoder.decode(pathWithoutLeadingSlash, StandardCharsets.UTF_8);
pathToDecode = pathWithoutLeadingSlash;
}
// requires 10+ java database = URLDecoder.decode(pathWithoutLeadingSlash.substring(lastSlashIndex + 1), StandardCharsets.UTF_8);

Check warning on line 229 in jdbc-v2/src/main/java/com/clickhouse/jdbc/internal/JdbcConfiguration.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This block of commented-out lines of code should be removed.

See more on https://sonarcloud.io/project/issues?id=ClickHouse_clickhouse-java&issues=AZ15PHQ8zyWvgqmtq4rC&open=AZ15PHQ8zyWvgqmtq4rC&pullRequest=2821
database = URLDecoder.decode(pathToDecode);

Check warning on line 230 in jdbc-v2/src/main/java/com/clickhouse/jdbc/internal/JdbcConfiguration.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this use of "decode"; it is deprecated.

See more on https://sonarcloud.io/project/issues?id=ClickHouse_clickhouse-java&issues=AZ15PHQ8zyWvgqmtq4rD&open=AZ15PHQ8zyWvgqmtq4rD&pullRequest=2821
}

// Build connection URL with HTTP path preserved
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ private static Set<String> initAllowedKeywordAliases() {
"USER", "VALID", "VALUES", "VARYING", "VIEW", "VISIBLE", "VOLUME", "WATCH", "WATERMARK", "WEEK",
"WEEKS", "WHEN", "WITH_ITEMINDEX", "WK", "WORKER", "WORKLOAD", "WRITABLE", "WRITE", "WW",
"YEAR", "YEARS", "YY", "YYYY", "ZKPATH",
// Append 04/01/2026.
// Appended 04/01/2026.
"CENTURY", "DECADE", "DOW", "DOY", "EPOCH", "ISODOW", "ISOYEAR", "MILLENNIUM", "NATURAL", "SOME",
"ZONE"
"ZONE",
// Appended 04/10/2026
"PATH", "PLACING"
);
}

Expand Down
Loading