No database found to handle jdbc:oracle:thin

I can't get Maven or Gradle to connect to an Oracle database on a local server. I'll admit, I'm completely new to CI/CD using Maven or Gradle so it might be a configuration issue. Interesting thing though, it's the same error from both.

pom.xml
__________________________________________________
<dependencies>
  <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.11</version>
    <scope>test</scope>
  </dependency>
  <dependency>
  <groupId>com.oracle.database.jdbc</groupId>
  <artifactId>ojdbc8</artifactId>
  <version>23.2.0.0</version>
  </dependency>
</dependencies>
...
<plugin>
    <groupId>org.flywaydb</groupId>
    <artifactId>flyway-maven-plugin</artifactId>
    <version>9.20.1</version>
    <configuration>
<driver>com.oracle.database.jdbc.ClientDriver</driver>
<user>*****</user>
<password>*****</password>
</configuration>

If I just run Flyway by itself, I can get connected and run migrations. I only get connection errors when I try to use it with other tools.

Oracle version: 19.3.0.0
Flyway version: Flyway Community Edition 9.20.0
Maven version: Apache Maven 3.5.4 (Red Hat 3.5.4-5)
Gradle version: Gradle 8.2.1
Java version: openjdk version "1.8.0_372"
OS version: Oracle Linux Server 8.8

Best Answer

  • Peter_LawsPeter_Laws Posts: 289 Silver 2
    Hello mholmes,

    This mostly looks correct. I think you may need to explicitly add the flyway-database-oracle dependency as detailed here.

    If you're able to share the exception you receive that might also help.
    Kind regards
    Peter Laws | Redgate Software
    Have you visited our Help Center?

Answers

  • mholmesmholmes Posts: 2 New member
    Peter,

    Thanks for the help! I did add the dependency in Maven and also found another error with the driver line for the plugin.

    I changed 
    <driver>com.oracle.database.jdbc.ClientDriver</driver>
    to 
    <driver>oracle.jdbc.OracleDriver</driver>

    And got the output you would expect:
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 5.307 s
    [INFO] Finished at: 2023-07-24T11:40:47-05:00
    [INFO] ------------------------------------------------------------------------


    Thanks again and I appreciate the help!
  • Excellent news!
    Not at all, my pleasure, have a good week.
    Kind regards
    Peter Laws | Redgate Software
    Have you visited our Help Center?

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file