[修改]:修改配置文件以及pom文件、test测试类用于数据库连接,[添加]:新增数据库驱动文件
This commit is contained in:
7
pom.xml
7
pom.xml
@ -49,6 +49,13 @@
|
|||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- KingbaseES V8/V9 数据库 JDBC 驱动 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.kingbase8</groupId>
|
||||||
|
<artifactId>kingbase8</artifactId>
|
||||||
|
<version>9.0.0</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
@ -1 +1,11 @@
|
|||||||
spring.application.name=intelligent-application-orchestration-service
|
spring.application.name=intelligent-application-orchestration-service
|
||||||
|
|
||||||
|
|
||||||
|
# 数据库配置
|
||||||
|
spring.datasource.url=jdbc:kingbase8://116.205.121.200:54321/Ipz
|
||||||
|
spring.datasource.username=system
|
||||||
|
spring.datasource.password=root
|
||||||
|
spring.datasource.driver-class-name=com.kingbase8.Driver
|
||||||
|
spring.datasource.hikari.maximum-pool-size=10
|
||||||
|
spring.datasource.hikari.minimum-idle=5
|
||||||
|
spring.datasource.hikari.connection-timeout=30000
|
@ -1,13 +1,24 @@
|
|||||||
package com.bipt.intelligentapplicationorchestrationservice;
|
package com.bipt.intelligentapplicationorchestrationservice;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
class IntelligentApplicationOrchestrationServiceApplicationTests {
|
class IntelligentApplicationOrchestrationServiceApplicationTests {
|
||||||
|
@Autowired
|
||||||
|
private DataSource dataSource;
|
||||||
@Test
|
@Test
|
||||||
void contextLoads() {
|
void contextLoads() throws SQLException {
|
||||||
|
// 尝试获取连接
|
||||||
|
assertNotNull(dataSource.getConnection(), "无法获取数据库连接!");
|
||||||
|
System.out.println("数据库连接成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user