无法将 Spring Boot 应用程序连接到 IBM Informix 数据库
Posted
技术标签:
【中文标题】无法将 Spring Boot 应用程序连接到 IBM Informix 数据库【英文标题】:Cannot Connect Spring Boot Application to IBM Informix Database 【发布时间】:2017-02-01 01:11:52 【问题描述】:我无法将我的 Spring Boot 应用程序连接到 IBM Informix 数据库。我在 application.yml 文件中添加了 informix 数据源。
我正在使用 spring 4。
我收到以下错误。
com.informix.jdbcx.IfxXADataSource 类中没有可写属性“url”
spring.profiles.active: db_dummy
spring.mvc.view:
prefix: /WEB-INF/jsp/
suffix: .jsp
spring.messages.basename: static/resources/messages/pjMessageResource, static/resources/messages/pymacMessageResource, static/resources/messages/messageResource, static/resources/messages/base
spring.datasource:
url: jdbc:informix-sqli://x.x.x.x:9093/testdb:informixserver=myserver;
driverClassName: com.informix.jdbc.IfxDriver
username: informix
password: sss
xa:
dataSourceClassName: com.informix.jdbcx.IfxXADataSource
#----------------------------------------------------------
security.basic.enabled: false
spring.jackson.serialization.INDENT_OUTPUT: true
server.error.whitelabel.enabled: false
management:
context-path: /_mep
security.enabled: false
#security.role: SUPERUSER
multipart.maxFileSize: 10Mb
spring:
jpa:
openInView: true
show-sql: false
properties:
hibernate:
connection.charSet: UTF-8
format_sql: true
use_sql_comments: true
jdbc:
batch_size: 30
fetch_size: 100
jadira:
usertype:
autoRegisterUserTypes: true
javaZone: jvm
databaseZone: jvm
---
#----------------------------------------------------------------
# development
#----------------------------------------------------------------
spring.profiles: development
secondary.datasource:
url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
driverClassName: org.h2.Driver
username: sa
password:
xa:
dataSourceClassName: org.h2.jdbcx.JdbcDataSource
#----------------------------------------------------------
---
#----------------------------------------------------------------
# staging or production
#----------------------------------------------------------------
spring.profiles: staging,production
spring.jpa.database_platform: org.hibernate.dialect.InformixDialect
---
#----------------------------------------------------------------
# psql
#----------------------------------------------------------------
spring.profiles: informix
spring.datasource:
url: jdbc:informix-sqli://x.x.x.x:9093/aaa:informixserver=test;
driverClassName: com.informix.jdbc.IfxDriver
username: informix
password:
xa:
dataSourceClassName: com.informix.jdbcx.IfxXADataSource
---
#----------------------------------------------------------------
# h2
#----------------------------------------------------------------
spring.profiles: h2
spring.datasource:
url: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
driverClassName: org.h2.Driver
username: sa
password:
xa:
dataSourceClassName: org.h2.jdbcx.JdbcDataSource
【问题讨论】:
【参考方案1】:在 pom 中添加带有相关 versionID 的 Informix 作为依赖项。
<dependency>
<groupId>com.ibm.informix</groupId>
<artifactId>jdbc</artifactId>
<version>versionID</version>
</dependency>
【讨论】:
【参考方案2】:您是否包含名为 1)ifxjdbc & 2)ifxjdbcx jars 的 jars。
【讨论】:
以上是关于无法将 Spring Boot 应用程序连接到 IBM Informix 数据库的主要内容,如果未能解决你的问题,请参考以下文章
无法将 dockerized spring boot 应用程序连接到 dockerized postgresql
无法从 docker 容器内的 Spring Boot 连接到 Redis
无法将 spring-boot 2 服务连接到不同容器中的 mysql
当我将 Spring Boot 应用程序部署到 AWS Elastic Beanstalk 并且无法从本地 Spring Boot 连接到 RDS 时出现 502 错误网关