Spring 弹簧靴蟑螂Db

Spring 弹簧靴蟑螂Db,spring,spring-boot,spring-data-jpa,spring-batch,cockroachdb,Spring,Spring Boot,Spring Data Jpa,Spring Batch,Cockroachdb,在将Coacroach Db与Spring引导和Spring批处理一起使用时,我遇到了以下错误 org.postgresql.util.PSQLException: ERROR: invalid value for parameter "TimeZone": "Europe/London" 详细信息:系统找不到指定的路径 应用程序属性 spring.datasource.driver-class-name=org.postgresql.Driver spring.jpa.properties.

在将Coacroach Db与Spring引导和Spring批处理一起使用时,我遇到了以下错误

org.postgresql.util.PSQLException: ERROR: invalid value for parameter "TimeZone": "Europe/London"
详细信息:系统找不到指定的路径

应用程序属性

spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL95Dialect
spring.datasource.username=root
spring.datasource.password=
spring.datasource.type=com.zaxxer.hikari.HikariDataSource

spring.datasource.url=jdbc:postgresql://localhost:26257/defaultdb?sslmode=disable&serverTimezone=UTC&useLegacyDatetimeCode=false

spring.jpa.properties.hibernate.jdbc.time_zone= UTC

spring.batch.initialize-schema = always
我还添加了这个和上面提到的属性,但没有帮助

@PostConstruct
void started() {
  TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
}

因此,我们看到了一些问题

1.  You said you are using Coacroach Db but you seem to be loading a JDBC JAR and ULR string for Postgres.  

2.  Posgres does not have "Europe/London" as a valid TimeZone String.  There is a "Europe/London GB GB-Eire" 
See: https://www.postgresql.org/docs/8.1/datetime-keywords.html

3.  You have a space in the time zone property name.
    This:       spring.jpa.properties.hibernate.jdbc.time_zone= UTC
    Should Be:  spring.jpa.properties.hibernate.jdbc.time_zone=UTC

出于好奇,您使用的是哪种操作系统?我们有一个已知会影响Windows的

当您指定UTC时区时,是否收到与“欧洲/伦敦”相同的错误?如果您尝试使用数字偏移,例如“+0:00”,会怎么样


此外,当通过URL设置时区时,参数应为
timezone=utc
(或您想要的任何其他值)。

1)正确的URL应该是什么?2) 我还没有设定欧洲/伦敦的时区,不知道它会在哪里出现。3)空间并没有解决这个问题。数据库URL应该是只有您知道的,但是如果它是CoacroachDB,正如您所说,那么URL中不应该有Posgres。“jdbc:postgresql://localhost而且不应该使用Postgres驱动程序“org.postgresql.Driver”蟑螂数据库没有驱动程序根本没有JDBC驱动程序?那么你永远不能在Java中使用它,所以我怀疑情况是否如此。无论哪种方法,知道使用了错误的方法都不会很好。@BrianC CockroachDB与Postgres是有线兼容的@ChandreshMishra使用PGJDBC驱动程序和带有
postgresql
前缀的URL是正确的。我们这里有一个关于蟑螂B和Spring Boot的入门教程。(免责声明:我在蟑螂B上工作。)是的,我正在使用windows机器。如何通过URL进行设置?请尝试使用以下URL:jdbc:postgresql://localhost:26257/defaultdb?sslmode=disable&timezone=UTC