【发布时间】:2019-12-25 10:07:10
【问题描述】:
我正在尝试使用informix RDBMS 和Spring boot 创建一个Web 服务应用程序。
当我声明 ddl-auto = create 时,它工作得很好,但是当我将它更改为 update 或 none 时,我得到了错误。我的 informix 版本是 9.40.UC8。
spring.datasource.url=jdbc:informix-sqli://*.*.*.*:*/testechange:INFORMIXSERVER=server
spring.datasource.username=
spring.datasource.password=
spring.datasource.tomcat.max-wait=20000
spring.datasource.tomcat.max-active=50
spring.datasource.tomcat.max-idle=20
spring.datasource.tomcat.min-idle=15
spring.datasource.driver-class-name=com.informix.jdbc.IfxDriver
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.InformixDialect
spring.jpa.properties.hibernate.id.new_generator_mappings = false
spring.jpa.properties.hibernate.format_sql = true
spring.jpa.hibernate.ddl-auto=update
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
server.port=8182
@Entity
@Table(name ="todos")
public class Todo {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id ;
@Column
private String name ;
}
<dependencies>
<!-- https://mvnrepository.com/artifact/com.ibm.informix/jdbc -->
<dependency>
<groupId>com.ibm.informix</groupId>
<artifactId>jdbc</artifactId>
<version>4.10.6.20151104</version>
</dependency>
</dependencies>
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.GenericJDBCException: Error accessing tables metadata
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.GenericJDBCException: Error accessing tables metadata
Caused by: org.hibernate.exception.GenericJDBCException: Error accessing tables metadata
Caused by: java.sql.SQLException: Routine (get_data_type) can not be resolved.*
【问题讨论】:
-
在以
update或none开始之前,您能否检查表todos是否真的存在于数据库中? -
我修复了这个错误,只是我将 informix JDBC 版本更改为 4.50.2.fix
标签: java hibernate spring-boot informix