Options

No database found to handle jdbc:oracle:thin:@//localhost:3000/XEPDB1 error

I have an Oracle database express container running on my local computer. I am getting an error message when I run the migration command from my build.gradle file. The error says no database found to handle url. My build.gradle file is shown below.
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'
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()
}

Answers

  • Options
    Hi @pdrake1

    Thank you for reaching out on the Redgate forums and sorry to hear about your build error.

    The "No Database found to handle..." error is commonly associated with required dependencies not being included in the Gradle task.
    The provided file looks OK at first review, you have the flyway-database-oracle dependency declared which would be required for the connection.

    Two immediate concerns are if the dependencies are loading in as expected & if there is any kind of network concern blocking access to the dB/port when this is running

    * Are you able to enable any full/verbose logging on your pipeline to verify the dependencies do all load in as expected. Can you review to see if there is any further errors being generated. 

    * Are you also able to navigate to the localhost:3000/XEPDB1 database outside this pipeline? To confirm that it exists, is accessible, and the user is able to log into it


    Jon Kirkwood | Technical Support Engineer | Redgate Software
  • Options
    pdrake1pdrake1 Posts: 5 New member
    Ok first off thank you so much for replying, second I know for a fact that the port/connection isn't being blocked because I am able to access the database through the database tools integrated in intellij. So the next step is to figure out which dependencies are not being loaded correctly and I would like some input as to how best to go about doing that.
  • Options
    pdrake1pdrake1 Posts: 5 New member
    Ok I finally figured it out. It was the fact that I did not have a buildscript section. Thank you
  • Options
    Thank you for the update and very glad to hear you found a resolution with the missing buildscript section.

    Jon Kirkwood | Technical Support Engineer | Redgate Software
Sign In or Register to comment.