Skip to content

Commit

Permalink
Merge pull request #135 from /issues/134
Browse files Browse the repository at this point in the history
[Bug]: not set Clickhouse userName and password have npe #134
  • Loading branch information
czy006 authored Jun 14, 2024
2 parents 1a1b2a7 + 9bc4e3e commit 7346c14
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,14 @@ private ClickHouseConnection createConnection(String url, String database) throw
LOG.info("connecting to {}, database {}", url, database);
Properties configuration = new Properties();
configuration.putAll(connectionProperties);
configuration.setProperty(
ClickHouseDefaults.USER.getKey(), options.getUsername().orElse(null));
configuration.setProperty(
ClickHouseDefaults.PASSWORD.getKey(), options.getPassword().orElse(null));
if (options.getUsername().isPresent()) {
configuration.setProperty(
ClickHouseDefaults.USER.getKey(), options.getUsername().get());
}
if (options.getPassword().isPresent()) {
configuration.setProperty(
ClickHouseDefaults.PASSWORD.getKey(), options.getPassword().get());
}
ClickHouseDriver driver = new ClickHouseDriver();
return driver.connect(url, configuration);
}
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ limitations under the License.

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<junit.version>4.13.2</junit.version>
<clickhouse-jdbc.version>0.6.0-patch3</clickhouse-jdbc.version>
<clickhouse-jdbc.version>0.6.1</clickhouse-jdbc.version>
<scala.binary.version>2.12</scala.binary.version>
<flink.version>1.19.0</flink.version>
<flink.scope>provided</flink.scope>
Expand Down

0 comments on commit 7346c14

Please sign in to comment.