如何使用HikariPool连接Snowflake - SpringBoot,Gradle

How to use HikariPool to connect to Snowflake - SpringBoot, Gradle

我正在尝试使用 HikariPool 连接到 Snowflake。我正在使用 SpringBootGradle.

我将这些依赖项添加到 Gradle

implementation group: 'org.springframework.boot', name: 'spring-boot-starter-jdbc'
implementation 'net.snowflake:snowflake-jdbc:3.12.16'
implementation group: 'com.zaxxer', name: 'HikariCP', version: '5.0.0'

配置文件如下所示:

@Slf4j
@Configuration
public class SnowflakeRepositoryConfig {

    @Bean
    JdbcTemplate jdbcTemplate(@Value("${repository.snowflake.url}") String jdbcUrl,
                              @Value("${repository.snowflake.user}") String user,
                              @Value("${repository.snowflake.password}") String password){
        
        log.info("-----Configuring JDBCTemplate------");
        HikariConfig config = new HikariConfig();
        config.setDriverClassName("net.snowflake.client.jdbc.SnowflakeDriver");
        config.setJdbcUrl(jdbcUrl);
        config.setUsername(user);
        config.setPassword(password);
        HikariDataSource ds = new HikariDataSource(config);

        return new JdbcTemplate(ds);
    }
}

Application.yml

repository:
  snowflake:
    url: jdbc:snowflake://nw99383.eu-west-2.snowflakecomputing.com/?db=TEST_DB&warehouse=SF_TUTS_WH&schema=PUBLIC&tracing=ALL
    user: ****
    password: ****

我收到以下错误:

13:56:42.353 [main] ERROR net.snowflake.client.core.HttpUtil - Response status line reason: Forbidden
13:56:42.358 [main] ERROR net.snowflake.client.core.HttpUtil - Response content: <html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
</body>
</html>

13:56:43.371 [main] ERROR com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Exception during pool initialization.
net.snowflake.client.jdbc.SnowflakeSQLException: JDBC driver encountered communication error. Message: HTTP status=403.

能否更新 Snowflake 帐户 URL 并尝试: nw99383.eu-west-2.aws.snowflakecomputing.com/