1. 程式人生 > >IDEA Spring Boot 資料庫連線配置_備註

IDEA Spring Boot 資料庫連線配置_備註

idea版本及jdk環境:

首先是必須引入的:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

mysql:

pom.xml配置:

<!--mysql資料庫的依賴包-->
<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <scope>runtime</scope>
</dependency>

application配置:

#mysql資料庫連線配置
spring.datasource.url = jdbc:mysql://localhost:3306/xiaomi_qbms?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC
spring.datasource.username = root
spring.datasource.password =

sqlserver:

①需先匯入jar包:

選擇要匯入的sqljdbc4的jar包,OK完成。

②pom.xml配置:

<!-- sqlserver資料庫的依賴包 -->
<dependency>
    <groupId>com.microsoft.sqlserver</groupId>
    <artifactId>sqljdbc4</artifactId>
</dependency>

③application檔案配置:

#sqlserver資料庫連線配置 spring.datasource.url = jdbc:sqlserver://localhost:1433;database=iMatrix6.5RC3.p4;integratedSecurity=false; spring.datasource.username = sa spring.datasource.password = sa

oracle:

第①步同sqlserver.

②pom.xml配置:

<!-- oracle資料庫的依賴包 -->
<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc6</artifactId>
</dependency>

③application檔案配置:

#oracle資料庫連線配置
spring.datasource.url = jdbc:oracle:thin:@localhost:1522:orcl11g
spring.datasource.username = viewshine_qis
spring.datasource.password = viewshine_qis

正在學習IDEA,記錄學習過程的點滴。