mybatisplus 集成不同数据库
时间: 2023-07-11 07:47:29 浏览: 97
Mybatis-plus 支持集成不同类型的数据库,包括 MySQL、Oracle、SQLServer、PostgreSQL 等。在使用时,需要根据具体的数据库类型来配置相应的驱动和连接信息。以下是 Mybatis-plus 集成不同数据库的配置示例:
MySQL:
```properties
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/db_name?characterEncoding=utf-8&useSSL=false
spring.datasource.username=username
spring.datasource.password=password
```
Oracle:
```properties
spring.datasource.driverClassName=oracle.jdbc.driver.OracleDriver
spring.datasource.url=jdbc:oracle:thin:@localhost:1521:orcl
spring.datasource.username=username
spring.datasource.password=password
```
SQLServer:
```properties
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.datasource.url=jdbc:sqlserver://localhost:1433;DatabaseName=db_name
spring.datasource.username=username
spring.datasource.password=password
```
PostgreSQL:
```properties
spring.datasource.driverClassName=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost:5432/db_name
spring.datasource.username=username
spring.datasource.password=password
```
阅读全文