首页 > 解决方案 > Spring Boot 连接 Redshift 序列

问题描述

我正在尝试使用 Spring Boot 和 JPA 在 Redshift 数据库上连接来运行我的应用程序,但没有成功。谷歌搜索发现一些人有同样的问题,但建议是更改 RDS 或其他数据库,但我没有这个选项。在 Redshift 中 information_schema.sequences 不存在,所以我应该找到解决这个问题的方法

问题是:

无效操作:关系“information_schema.sequences”不存在;

在 Pom.xml 中:

<dependency>
        <groupId>com.amazon.redshift</groupId>
        <artifactId>redshift-jdbc4</artifactId>
        <version>1.2.10.1009</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>

在我的 application.properties 中:

spring.datasource.driver-class-name=com.amazon.redshift.jdbc4.Driver
spring.datasource.url=jdbc:redshift://redshift-cluster-1.xxxxxxxx.us-west-2.redshift.amazonaws.com:xxxx/db
spring.datasource.username=xxxxxxxx
spring.datasource.password=xxxxxxxx

spring.datasource.testWhileIdle = true
spring.datasource.validationQuery = SELECT 1

spring.jpa.show-sql = true
spring.jpa.hibernate.ddl-auto=validate
spring.jpa.properties.hibernate.dialect =  org.hibernate.dialect.PostgreSQL9Dialect
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation = true 
spring.jpa.properties.hibernate.current_session_context_class =org.springframework.orm.hibernate5.SpringSessionContex

但是在启动应用程序时,控制台显示:

2019-11-27 23:48:50.414 错误 16608 --- [main] ohejeinternal.JdbcEnvironmentImpl:无法从数据库中获取 SequenceInformation java.sql.SQLException:亚马逊无效操作:关系“information_schema.sequences”不存在;在 com.amazon.redshift.client.messages.inbound.ErrorResponse.toErrorException(Unknown Source) ~[na:na] at com.amazon.redshift.client.PGMessagingContext.handleErrorResponse(Unknown Source) ~[na:na] at com .amazon.redshift.client.PGMessagingContext.handleMessage(Unknown Source) ~[na:na] at com.amazon.jdbc.communications.InboundMessagesPipeline.getNextMessageOfClass(Unknown Source) ~[na:na] at com.amazon.redshift.client .PGMessagingContext.doMoveToNextClass(Unknown Source) ~[na:na] at... 引起:com.amazon.support.exceptions.ErrorException:亚马逊无效操作:关系“information_schema.sequences”不存在;...省略了 54 个常见框架 2019-11-27 23:48:51.487 WARN 16608 --- [main] ohengine.jdbc.spi.SqlExceptionHelper:SQL 错误:500310,SQLState:42P01 2019-11-27 23:48: 51.487 错误 16608 --- [
main] ohengine.jdbc.spi.SqlExceptionHelper:亚马逊无效操作:关系“information_schema.sequences”不存在;

如果有人帮助我,我将非常感激!!!!

标签: amazon-web-serviceshibernatespring-bootjpaamazon-redshift

解决方案


推荐阅读