【发布时间】:2019-11-19 08:59:41
【问题描述】:
我正在尝试在我的 Spring Boot 应用程序中建立与 Redshift 数据库的连接。我的属性文件中有以下条目。
spring.datasource.driver-class-name=com.amazon.redshift.jdbc41.Driver
spring.datasource.url=jdbc:redshift://redshift_url/db_name
spring.datasource.username=username
spring.datasource.password=password
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.SpringSessionContext
在 pom.xml 我有以下条目。
<dependency>
<groupId>com.amazon.redshift</groupId>
<artifactId>redshift-jdbc41</artifactId>
<version>1.2.10.1009</version>
</dependency>
我已经创建了一个如下所示的 POJO 文件。
@Entity
@Table(name = "some_data_table")
public class SomeDataTable {
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
private long id;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "created_at", nullable = false)
private Date createdAt;
@Temporal(TemporalType.TIMESTAMP)
@Column(name="date",nullable = false)
private Date date;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "updated_at", nullable = false)
private Date updatedAt;
@Column(name = "data_source", nullable = false)
private String dataSource;
Getters and Setters...
}
但是每当我启动应用程序时,我都会遇到错误。
Caused by: java.sql.SQLException: [Amazon](500310) Invalid operation: relation "information_schema.sequences" does not exist;
at 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]
请指导我解决此错误。
【问题讨论】:
标签: hibernate spring-boot spring-data-jpa amazon-redshift persistence