일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- google oauth
- hanghae99
- Spring Security
- flask
- Hibernate
- Java
- real time web
- session
- html
- spring
- 항해99
- Anolog
- 생명주기 콜백
- DI
- bean
- Project
- programmers
- server send event
- jQuery
- python
- cookie
- web
- Stream
- jenkins
- JPA
- oauth
- SseEmitter
- JWT
- javascript
- WIL
- Today
- Total
끄적끄적 코딩일지
[Spring]이미지 월드컵 만들기(2) - Database 연결 본문
지난 시간에 이미지 월드컵을 만들기 위한 Spring프로젝트를 생성해 봤다.
2022.05.18 - [Project/[Spring] 이미지 월드컵 만들기] - [Spring boot]이미지 월드컵 만들기(1) - 프로젝트 세팅
사용할 Database는 고민끝에 가장 익숙한 Postgresql을 사용하기로 결정
build.gradle에 jdbc postgres driver 라이브러리를 추가하자
그리고 application.properties 수정
spring.datasource.url -> 연결할 database 주소
spring.datasource.username -> database에 로그인할 user, postgresql기준 기본값 postgres
spring.datasource.password -> database 설치시 혹은 user 생성시 설정한 비밀번호
spring.jpa.hibernate.ddl-auto -> 테이블 생성 전략
spring.datasource.driver-class-name -> database와 연결할 driver
그리고 한번 실행시켜 database 연결 테스트를 해보는데...
잉...??
왜 에러가 나지?
오류내용은
org.postgresql.util.PSQLException: The authentication type 10 is not supported. Check that you have configured the pg_hba.conf file to include the client's IP address or subnet, and that it is using an authentication scheme supported by the driver.
postgresql에서는 외부접속을 허용하기 위해 pg_hba.conf 파일과 postgresql.conf 파일을 수정해야 한다.
그런데 local으로 접속하는데 왜 저런 오류가 뜨는거지???
혹시몰라 해당 파일을 확인해 보는데 예전에 외부접속이 가능하도록 이미 수정해둔 파일...
구글링을 해보니
Postgres driver 버전 문제란다.
build.gradle으로 돌아가서 postgres jdbc driver 버전 수정
https://mvnrepository.com/artifact/org.postgresql/postgresql
그리고 실행해 보니 아주 잘 돌아간다 ㅎㅎ
다음 글에서는 Entity를 설계해 보겠다.
'Project > [Spring] 이미지 월드컵 만들기' 카테고리의 다른 글
[Spring]이미지 월드컵 만들기 (6)- 이미지 업로드(2) (0) | 2022.05.24 |
---|---|
[Spring]이미지 월드컵 만들기(5) - 이미지 업로드(1) (0) | 2022.05.23 |
[Spring]이미지 월드컵 만들기(4) - 기능 설계하기 (1) | 2022.05.18 |
[Spring]이미지 월드컵 만들기(3) - DB Entity 설계하기 (0) | 2022.05.18 |
[Spring boot]이미지 월드컵 만들기(1) - 프로젝트 세팅 (0) | 2022.05.18 |