Exception against Oracle DB: “Error while determining database product name: Unsupported feature”

非 Y 不嫁゛ 提交于 2019-12-11 13:15:15

问题


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>

来源:https://stackoverflow.com/questions/14734804/exception-against-oracle-db-error-while-determining-database-product-name-uns

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!