MySQL
当url连接不指定/数据库名
可以访问到mysql服务器上有权限的任何库,但是所有sql需要加上库名前缀.
- pom
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
- 配置
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/text?ssl=false&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&autoReconnect=true&rewriteBatchedStatements=true&allowMultiQueries=true
username: username
password: password
达梦
达梦新建用户的时候会同时创建一个同名的数据库并绑定,这时候这个用户访问同名数据库的时候不需要加库名前缀.
,否则所有sql都需要加上库名前缀.
- pom
<dependency>
<groupId>com.dameng</groupId>
<artifactId>DmJdbcDriver18</artifactId>
<version>8.1.1.193</version>
</dependency>
- 配置
spring:
datasource:
driver-class-name: dm.jdbc.driver.DmDriver
url: jdbc:dm://127.0.0.1:5236/TEST??ssl=false&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&autoReconnect=true&rewriteBatchedStatements=true&allowMultiQueries=true
username: username
password: password
标签:username,jdbc,springboot,写法,数据库,mysql,password,true
From: https://www.cnblogs.com/ranger-dev/p/17320470.html