Skip to content

Commit b777125

Browse files
committed
used enquoteIdentifier to escape quotes in cluster name
1 parent 3c8b1fc commit b777125

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

jdbc-v2/src/main/java/com/clickhouse/jdbc/ConnectionImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public ConnectionImpl(String url, Properties info) throws SQLException {
7676
this.config = new JdbcConfiguration(url, info);
7777
final String tmpClusterName = config.getDriverProperty(DriverProperties.CLUSTER_NAME.getKey(), DriverProperties.CLUSTER_NAME.getDefaultValue());
7878
this.cluster = tmpClusterName == null ? null : tmpClusterName.trim();
79-
this.onCluster = this.cluster != null && !this.cluster.trim().isEmpty();
79+
this.onCluster = this.cluster != null && !this.cluster.isEmpty();
8080
this.appName = "";
8181
this.readOnly = false;
8282
this.holdability = ResultSet.HOLD_CURSORS_OVER_COMMIT;

jdbc-v2/src/main/java/com/clickhouse/jdbc/StatementImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ public void cancel() throws SQLException {
334334
}
335335

336336
try (QueryResponse response = connection.getClient().query(String.format("KILL QUERY%sWHERE query_id = '%s'",
337-
connection.onCluster ? " ON CLUSTER `" + connection.cluster + "` " : " ",
337+
connection.onCluster ? " ON CLUSTER " + SQLUtils.enquoteIdentifier(connection.cluster, true) + ' ' : ' ',
338338
lastQueryId), connection.getDefaultQuerySettings()).get()){
339339
LOG.debug("Query {} was killed by {}", lastQueryId, response.getQueryId());
340340
} catch (Exception e) {

0 commit comments

Comments
 (0)