spring boot 配置sqlserver

pom文件:

1
2
3
4
5
<dependency>
    <groupId>com.microsoft.sqlserver</groupId>
    <artifactId>sqljdbc4</artifactId>
    <version>4.0</version>
</dependency>

配置:

1
2
3
4
5
6
spring:
  datasource:
    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
    url: jdbc:sqlserver://192.168.0.111:1433;DatabaseName=databasename
    username: sa
    password: 123456

扩展:
SqlServer 对语句的条数和参数的数量都有限制,分别是 1000 和 2100。
ps:

1
2
insert into guest.[user] (id,name) values ("1","1"),("2","3")
这是4个参数

Mysql 对语句的长度有限制,默认是 4M。
Mybatis 对动态语句没有数量上的限制。


安装ojdbc6-11.2.0.1.0到本地仓库

错误提示:
Registered driver with driverClassName=oracle.jdbc.driver.OracleDriver was n
Driver does not support get/set network timeout for connections. (com.mysql.jdbc.JDBC4Connection.getNetworkTimeout()I)
解决:
手动安装ojdbc6-11.2.0.1.0

下载文件(老铁免费):https://download.csdn.net/download/sunshuaisunshuai/10706134
打开cmd (前提是电脑是装了maven的哈)
执行命令:
-Dfile: jar包位置。不要把包放在maven库里,不然会提示路径已存在。命令会自己寻找maven路径的。

1
mvn install:install-file -Dfile=/C/Users/zhaoyun/Downloads/ojdbc6-11.2.0.3.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.1.0 -Dpackaging=jar





dubbo管理平台—dubbo-admin

下载地址1:https://github.com/apache/incubator-dubbo
下载地址2:https://download.csdn.net/download/idujiang/10767269
地址1下载方式:
搜索 dubbo-admin 找到

点击 Dubbo-Ops

下载

修改配置文件:dubbo-admin\src\main\resources\application.properties,根据实际情况

1
2
server.port=7001
dubbo.registry.address=zookeeper://127.0.0.1:2181

打包:

1
mvn clean install

启动dubbo-admin/target下jar包:java -jar dubbo-……jar,访问IP:7001
账密:root,root

完成


springboot启动类必要注解

默认存在:@SpringBootApplication
1.注解@MapperScan

1
@MapperScan("com.hachuizi.service.dao")

如果没有,错误情况:

1
2
3
4
5
6
7
8
9
10
11
12
13
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-11-05-16:02:16.006 ERROR 42   --- [main           ] o.s.b.d.LoggingFailureAnalysisReporter   :

***************************
APPLICATION FAILED TO START
***************************

Description:

Field userDao in com.hachuizi.service.UserService required a bean of type 'com.hachuizi.service.dao.UserDao' that could not be found.

或者
java.lang.IllegalArgumentException: At least one base package must be specified

ˆ Back To Top