SQLserver yml配置没问题 但是却报数据库找不到表
Cause: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'xxxx'.
nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'xxxx'.] with root cause
逛了很多博客 基本都是什么数据库连接url不对 ,根本没卵用
我检查了好几遍自己yml都没错
server:
port: XXXX
servlet:
context-path: /share
spring:
application:
name: share
datasource:
url: jdbc:sqlserver://数据库ip:端口号;DatabaseName=数据库名
username: 用户名
password: 密码
driver-class: com.microsoft.sqlserver.jdbc.SQLServerDriver
name: datasource
type: com.alibaba.druid.pool.DruidDataSource
druid:
initial-size: 10
max-active: 100
max-wait: 60000
min-idle: 10
validation-query: SELECT 1
test-on-borrow: false
test-on-return: false
min-evictable-idle-time-millis: 300000
test-while-idle: true
time-between-eviction-runs-millis: 30000
max-pool-prepared-statement-per-connection-size: 20
pool-prepared-statements: true
max-open-prepared-statements: 20
data:
mongodb:
uri: mongodb://mongodbip:端口号/mongodb
servlet:
multipart:
max-file-size: 100MB
max-request-size: 100MB
redis:
host: 10.0.2.86
port: 6379
main:
allow-bean-definition-overriding: true
jackson:
date-format: yyyy-MM-dd
time-zone: GMT+8
serialization:
write-dates-as-timestamps: false
pagehelper:
reasonable: true
support-methods-arguments: true
page-size-zero: true
mybatis:
mapper-locations: classpath:mapper/*.xml
type-aliases-package: com.graphsafe.api.model.share.po
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
eureka:
client:
registerWithEureka: true #服务注册开关
fetchRegistry: true #服务发现开关
serviceUrl: #Eureka客户端与Eureka服务端进行交互的地址,多个中间用逗号分隔
defaultZone: ${EUREKA_SERVER:http://localhost:8073/eureka/}
instance:
prefer-ip-address: true #将自己的ip地址注册到Eureka服务中
ip-address: ${IP_ADDRESS:127.0.0.1}
instance-id: ${spring.application.name}:${server.port} #指定实例id
ribbon:
MaxAutoRetries: 2 #最大重试次数,当Eureka中可以找到服务,但是服务连不上时将会重试,如果eureka中找不到服务则直接走断路器
MaxAutoRetriesNextServer: 3 #切换实例的重试次数
OkToRetryOnAllOperations: false #对所有操作请求都进行重试,如果是get则可以,如果是post,put等操作没有实现幂等的情况下是很危险的,所以设置为false
ConnectTimeout: 5000 #请求连接的超时时间
ReadTimeout: 6000 #请求处理的超时时间
logging:
level:
com.share.mapper: debug
终于在一篇博客中找到了答案
https://blog.csdn.net/Alone_in_/article/details/93848044博客中找到了解答
其中最最主要的就是在mybatis 的SQL那块添加
USE xxx表名
例如