乐趣区

关于springboot:Mybatis与SQL连接配置

MySQL

MySQL 依赖

        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>2.2.2</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>

application.properties 配置

spring.datasource.url=jdbc:mysql://IP 地址 / 数据库?serverTimeZone=GMT%2B8&Character=utf8
spring.datasource.username= 账号
spring.datasource.password= 明码

mybatis.mapper-locations=classpath:/mapper/*.xml

Oracle

Oracle 依赖

        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>2.2.2</version>
        </dependency>

        <dependency>
            <groupId>com.oracle.database.jdbc</groupId>
            <artifactId>ojdbc8</artifactId>
            <version>12.2.0.1</version>
        </dependency>

application.peoperties

spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.url=jdbc:oracle:thin:@IP 地址
spring.datasource.username= 账号
spring.datasource.password= 明码 
退出移动版