前言

业务中需要连接informix数据库,没连接过,写篇博客记录下连接方法

1、application.yml

server:
port: 8081
spring:
http:
multipart:
enabled: true
maxFileSize: 10Mb
maxRequestSize: 10Mb
mvc:
hiddenmethod:
filter:
enabled: true
application:
name: webapi
datasource: #database
url: jdbc:informix-sqli://127.0.0.1:8080/test:informixServer=admin;NEWCODESET=gbk,8859-1,819
username: admin
password: admin
driver-class-name: com.informix.jdbc.IfxDriver

pom

注意版本,这个很重要,版本太新会报错,比如说这个
​java.sql.SQLException: Locale not supported.​​如果不确定最好看下数据库版本然后去maven库里找同日期的驱动

<!-- https://mvnrepository.com/artifact/com.ibm.informix/jdbc -->
<dependency>
<groupId>com.ibm.informix</groupId>
<artifactId>jdbc</artifactId>
<version>4.10.9</version>
</dependency>

启动即可