我正在尝试使用创建一个 Spring Boot 应用程序sqljdbc4 https://mvnrepository.com/artifact/com.microsoft.sqlserver/sqljdbc4具有此配置的驱动程序:
spring:
datasource:
url: "jdbc:sqlserver://dbhost:1433;databaseName=test"
username: dbuser
password: dbuser
tomcat:
test-on-borrow: true
validation-query: select 1
但是,当我运行时,我收到此错误:Unable to detect database type
我正在调试BatchDatabaseInitializer
,错误从哪里来,以及何时调用JdbcUtils.commonDatabaseName(...)
,“Microsoft SQL Server”作为产品名称返回,与任何 DatabaseDriver 的产品名称都不匹配。
我尝试了其他驱动程序,但他们都有同样的问题。
这是一个错误吗?
我正在使用 Spring Boot 1.5.1-RELEASE。
如果您使用 spring-batch 创建批处理作业,则需要在 application.properties 文件中正确配置 spring.datasource 配置。下面是我的->
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/batch_repo
spring.datasource.username=batch_username
spring.datasource.password=batch_password
spring.datasource.platform=mysql
spring.batch.initialize-schema=always
spring.batch.初始化架构当配置为“always”,将在您的架构中创建必要的 Spring Batch 相关表。
或者,如果您将其分配给“never",它将避免创建表。在这两种情况下,您的错误都应该得到解决。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)