java.lang.IllegalStateException:无法检测Sybase数据源的数据库类型

时间:2017-05-10 08:06:32

标签: spring-boot

我无法检测在Spring启动应用程序中配置的Sybase数据源的数据库类型。

Spring启动版:1.5.3

application.properties

spring.datasource.url=jdbc:jtds:sybase://db-server-name:5555/DBNAME
spring.datasource.username=db_user
spring.datasource.password=db_password
spring.datasource.driver-class-name=net.sourceforge.jtds.jdbc.Driver

spring.jpa.database=sybase
spring.jpa.database-platform=org.hibernate.dialect.SybaseDialect

调试信息:

// line number 75 in AbstractDatabaseInitializer class
String productName = JdbcUtils.commonDatabaseName(JdbcUtils
                    .extractDatabaseMetaData(this.dataSource, "getDatabaseProductName")
                    .toString());
// productName is returned as Sybase from JdbcUtils.extractDatabaseMetaData
DatabaseDriver databaseDriver = DatabaseDriver.fromProductName(productName);
// but there is no databaseDriver found and is returned as UNKNOWN. 
// There is no Sybase database configured in DatabaseDriver enum

DatabaseDriver枚举中没有配置Sybase数据源。你能快速帮忙解决这个问题吗?

错误堆栈跟踪以供参考:

Caused by: java.lang.IllegalStateException: Unable to detect database type
        at org.springframework.boot.autoconfigure.AbstractDatabaseInitializer.getDatabaseName(AbstractDatabaseInitializer.java:80)
        at org.springframework.boot.autoconfigure.batch.BatchDatabaseInitializer.getDatabaseName(BatchDatabaseInitializer.java:54)
        at org.springframework.boot.autoconfigure.AbstractDatabaseInitializer.initialize(AbstractDatabaseInitializer.java:61)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:366)
        at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:311)
        at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:134)
        ... 17 common frames omitted

0 个答案:

没有答案