我正在尝试使用 FlywayDB 在 Spring Boot 项目中进行迁移,但收到一条错误消息,提示找不到可以处理我的 url 的数据库。该数据库正在我本地计算机上的 Docker 容器中运行。该数据库是最新版本的Oracle Express。我的 build.gradle 文件如下所示。
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id 'org.springframework.boot' version '3.2.1'
id 'io.spring.dependency-management' version '1.1.4'
id 'org.jetbrains.kotlin.jvm' version '1.9.21'
id 'org.jetbrains.kotlin.plugin.spring' version '1.9.21'
id 'org.jetbrains.kotlin.plugin.jpa' version '1.9.21'
id 'org.flywaydb.flyway' version '10.4.1'
}
flyway {
url = 'jdbc:oracle:thin:@//localhost:3000/XEPDB1'
user = 'pdbadmin'
password = 'my_password'`your text`
driver = 'oracle.jdbc.OracleDriver'
cleanDisabled = false
}
group = 'com.pdrake'
version = '0.0.1-SNAPSHOT'
java {
sourceCompatibility = '17'
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'
implementation 'org.flywaydb:flyway-core'
implementation 'org.flywaydb:flyway-database-oracle'
implementation 'org.jetbrains.kotlin:kotlin-reflect'
implementation 'org.springframework.session:spring-session-core'
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6'
implementation 'org.springframework.session:spring-session-core'
implementation 'org.springframework.session:spring-session-core'
implementation 'org.springframework.session:spring-session-core'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
runtimeOnly 'com.oracle.database.jdbc:ojdbc11'
}
tasks.withType(KotlinCompile) {
kotlinOptions {
freeCompilerArgs += '-Xjsr305=strict'
jvmTarget = '17'
}
}
tasks.named('test') {
useJUnitPlatform()
}
我尝试使用不同的 url 组合,我希望至少能看到它正在查看数据库。
检查url的IP和端口是否正确