Post

Spring Boot Log4jdbc 설정시 데이터베이스 jdbc-url

1. Log4jdbc 설정

2. driver-class-name 설정

  • 수정 전
1
2
# PostgreSQL Driver
spring.datasource.driver-class-name=org.postgresql.Driver
  • 수정 후
1
spring.datasource.driver-class-name=net.sf.log4jdbc.sql.jdbcapi.DriverSpy

3. jdbc-url 설정

log4jdbc를 추가한다.

  • 수정 전
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# PostgreSQL
jdbc:postgresql://localhost:5432/postgres?charSet=UTF-8

# Oracle
jdbc:oracle:thin:@localhost:1521/xe

# MariaDB
jdbc:mariadb://localhost:3306/test?characterEncoding=UTF-8

# MySQL
jdbc:mysql://localhost:3306/test?characterEncoding=UTF-8

# SQLServer
jdbc:sqlserver://localhost:1433;DatabaseName=AdventureWorks;integratedSecurity=true
  • 수정 후
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# PostgreSQL
jdbc:log4jdbc:postgresql://localhost:5432/postgres?charSet=UTF-8

# Oracle
jdbc:log4jdbc:oracle:thin:@localhost:1521/xe

# MariaDB
jdbc:log4jdbc:mariadb://localhost:3306/test?characterEncoding=UTF-8

# MySQL
jdbc:log4jdbc:mysql://localhost:3306/test?characterEncoding=UTF-8

# SQLServer
jdbc:log4jdbc:sqlserver://localhost:1433;DatabaseName=AdventureWorks;integratedSecurity=true
This post is licensed under CC BY 4.0 by the author.