Exception against Oracle DB: “Error while determin

2019-08-02 22:21发布

I am attempting to use Flyway 2.0.3 against the following Oracle database:

  • Oracle Database: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0
  • Oracle JDBC Driver: v9.0.2.0.0

When trying to use Flyway through maven (mvn flyway:info -e), I get the error below:

Caused by: java.sql.SQLException: Unsupported feature
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
    at oracle.jdbc.dbaccess.DBError.throwUnsupportedFeatureSqlException(DBError.java:689)
    at oracle.jdbc.OracleDatabaseMetaData.getDatabaseMajorVersion(OracleDatabaseMetaData.java:4442)
    at com.googlecode.flyway.core.dbsupport.DbSupportFactory.getDatabaseProductName(DbSupportFactory.java:113)
    ... 27 more

Although if I try again, but using newer versions of the driver (v9.2+), flyway works fine :)

Looking at the offending OracleDatabaseMetaData.getDatabaseMajorVersion() method, I can see that it throws the explicitly throws the 'Unsupported feature' SQLException.

I was wondering if there is a reason why flyway may not cater for this eventuality?

Could it be an oversight (I can look into submitting a patch) or is it that Flyway can only support certain versions of the oracle driver (for whatever reason, not critiquing).

Cheers Guys!!!

UPDATE: Workaround

As I am using maven, I defined a newer version of the oracle driver in the flyway plugin definition. The project can still use the old driver dependency and the plugin can use a newer version:

<dependencies>
    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc14</artifactId>
        <version>9.0.2.0.0</version>
    </dependency>
    ...
</dependencies>

<plugin>
    <groupId>com.googlecode.flyway</groupId>
    <artifactId>flyway-maven-plugin</artifactId>
    <version>2.0.3</version>
    <dependencies>
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc14</artifactId>
            <version>10.2.0.4.0</version>
        </dependency>
                ...
    </dependencies>
        ...
</plugin>

0条回答
登录 后发表回答