Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- mysql
- github
- pem
- java
- isNotEmpty
- 리눅스
- oracle
- MariaDB
- spring
- IntelliJ
- 호이스팅
- Kibana
- SQL
- Python
- git
- Javascript
- 404error
- analytics4
- DBMS
- 명령어
- PostgreSQL
- springboot
- Linux
- 오블완
- 자바
- 티스토리챌린지
- iBatis
- mssql
- docker
- pandas
Archives
- Today
- Total
hanker
Spring - MySQL 연동 테스트 본문
반응형
public class DBConnectionTest {
private static final String DRIVER = "com.mysql.cj.jdbc.Driver"; // MySQL 8.x
// MySQL 5.x = com.mysql.jdbc.Driver
private static final String URL = "jdbc:mysql://localhost:3306/스키마명?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true";
private static final String USER = "아이디입력";
private static final String PASSWORD = "비밀번호입력";
@Test
public void testConnection() throws Exception{
Class.forName(DRIVER);
try(Connection con = DriverManager.getConnection(URL, USER, PASSWORD)){
System.out.println(con);
} catch(Exception e) {
e.printStackTrace();
}
}
}
반응형
'SPRING' 카테고리의 다른 글
Spring boot - jsonView 사용 (0) | 2021.01.12 |
---|---|
Spring boot - application.properties MySQL DB 설정 (0) | 2021.01.12 |
SPRING - 여러줄 주석방법 (0) | 2020.12.04 |
SPRING - java.sql.Date 와 java.util.Date의 차이 (0) | 2020.11.05 |
SPRING - mybatis에서 resultType=boolean 사용하기 (0) | 2020.11.02 |