2014-09-22 45 views
0

是我對數據源org.flywaydb.core.api.FlywayException:錯誤而確定的數據庫產品名稱下方

<bean id="datasource" class="org.springframework.jndi.JndiObjectFactoryBean"> 
     <property name="jndiName" value="java:comp/env/jdbc/intdb" /> 
</bean> 

和遷徙路線豆配置JNDI查找是

<bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate"> 
     <property name="dataSource" ref="datasource" /> 
    </bean> 

下面我列舉越來越異常,但如果我替換JNDI查找與豆的所有屬性,它工作正常,

引起:org.flywaydb.core.api.FlywayEx ception:錯誤而 在org.flywaydb.core.internal.dbsupport.DbSupportFactory.getDatabaseProductName(DbSupportFactory.java:139) 在org.flywaydb.core.internal.dbsupport.DbSupportFactory.createDbSupport(DbSupportFactory.java確定數據庫產品名稱 :59) at org.flywaydb.core.Flyway.execute(Flyway.java:1147) at org.flywaydb.core.Flyway.migrate(Flyway.java:811) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native法) 在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 在java.lang.reflect.Method.invoke(Method.java: 597) at org.sp ringframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1581) 在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1522) 在org.springframework.beans.factory。在oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) 不支持的功能 在:support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452) ...... 26多個 造成的:值java.sql.SQLException oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269) at oracle.jdbc.dbaccess.DBError.th rowUnsupportedFeatureSqlException(DBError.java:689) 在oracle.jdbc.OracleDatabaseMetaData.getDatabaseMajorVersion(OracleDatabaseMetaData.java:4442) 在org.flywaydb.core.internal.dbsupport.DbSupportFactory.getDatabaseProductName(DbSupportFactory.java:134)

回答

1

我有類似的,工作配置在我的項目。在Spring上下文XML我有:

<bean id="migrationDataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> 
    <property name="jndiName" value="jdbc/myTestDb"/> 
</bean> 
<bean id="dbMigrationManager" class="test.version.DbMigrationManager" init-method="updateDatabaseSchema"> 
    <constructor-arg name="migrationDataSource" ref="migrationDataSource"/> 
</bean> 

我在DbMigrationManager構造函數的參數包裝數據源。它看起來像這樣:

package test.version;

import org.flywaydb.core.Flyway; 

import javax.sql.DataSource; 

public class DbMigrationManager { 

    private final DataSource dataSource; 

    public DbMigrationManager(DataSource migrationDataSource) { 
     this.dataSource = migrationDataSource; 
    } 

    public void updateDatabaseSchema() { 
     Flyway flyway = new Flyway(); 
     flyway.setDataSource(dataSource); 
     flyway.migrate(); 
    } 

} 

而且我在使用的gradle遷飛路線3.0版本是這樣的:

compile group: 'org.flywaydb', name: 'flyway-core', version: '3.0' 

如果不那麼也許有助於你的問題是特定的數據庫。就像在這個線程:

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

,或者你使用遷飛的一些老,越野車版本。