Gri*_*yev 1 db2 ibm-midrange spring-boot
我在尝试连接到数据库时遇到以下异常
HikariPool-1 - Driver does not support get/set network timeout for connections. (Receiver class com.ibm.as400.access.AS400JDBCConnectionImpl does not define or inherit an implementation of the resolved method abstract setNetworkTimeout(Ljava/util/concurrent/Executor;I)V of interface java.sql.Connection.)
这是我的 pom
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>net.sf.jt400</groupId>
<artifactId>jt400</artifactId>
<version>10.5</version>
</dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)
和应用程序yaml
spring.datasource:
url: jdbc:as400://xxx/xxx
username: xxx
password: xxx
driver-class-name: com.ibm.as400.access.AS400JDBCDriver
hikari.connection-test-query: values 1
spring.jpa:
database-platform: org.hibernate.dialect.DB2400Dialect
hibernate.ddl-auto: none
Run Code Online (Sandbox Code Playgroud)
您使用的 jt400.jar 版本错误。默认版本是使用 JDK 4 编译的。 setNetworkTimeout 方法需要 Executor 类,该类直到 JDK 1.6 才添加。您需要使用下载包中的 java6/jt400.jar 或 java8/jt400.jar 中的版本。
在Maven中,您需要指定jt400_jdk6分类器。
<dependency>
<groupId>net.sf.jt400</groupId>
<artifactId>jt400</artifactId>
<classifier>jt400_jdk6</classifier>
<version>10.5</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7599 次 |
| 最近记录: |