ElephantSQL 데이터베이스 연결
- 스프링 부트 프로젝트 ElephantSQL 데이터베이스 연결
- ElephantSQL 가입
- 인스턴스 생성
- build.gradle 의존성 추가 (기존에 있던 mysql은 주석 처리)
implementation 'org.postgresql:postgresql:42.2.2' // 추가 runtimeOnly 'org.postgresql:postgresql' // 추가
- application.yml 수정
spring: datasource: url: jdbc:postgresql://floppy.db.elephantsql.com:5432/(username) username: (username) password: driver-class-name: org.postgresql.Driver jpa: hibernate: ddl-auto: create properties: hibernate: database: postgresql database-platform: org.hibernate.dialect.PostgreSQLDialect format_sql: true use_sql_comments: true show_sql: true
- 연결 완료 및 테이블 생성 확인
- 프로젝트 실행 시 DB에 데이터 들어가는지 확인
728x90
'Computer Science > Database' 카테고리의 다른 글
[Database] Spring Boot 프로젝트와 MySQL DB 연결 (MVC, DTO) (0) | 2024.04.06 |
---|---|
[Database] Spring Boot 프로젝트와 H2 DB 연결 (0) | 2024.04.06 |
[Database] Java Project와 MySQL DB 연결 (JDBC) (0) | 2024.03.18 |
[Database] AWS RDS 데이터베이스 배포 및 연결 (0) | 2024.01.12 |