ssoyul 2024. 6. 7. 15:20

 

 

01. 오라클

 

spring:
    datasource:
      driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
      url: jdbc:log4jdbc:oracle:thin:@오라클 클라우드 경로
      username: 사용자 이름
      password: 비밀번호

 

 

 

build.gradle에 의존성 주입

    runtimeOnly 'com.oracle.database.jdbc:ojdbc8'
    implementation 'com.oracle.database.security:osdt_cert'
    implementation 'com.oracle.database.security:oraclepki'
    implementation 'com.oracle.database.security:osdt_core'

    implementation 'org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4:1.16'

 

 

 

테스트 컨트롤러 작성 후 연동되는 것을 확인

 

 

 

02. mysql

 

mysql로 연결하려니 자꾸 

 

2024-06-10 11:06:59.126 [http-nio-8080-exec-1] ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction] with root cause java.sql.SQLException: Access denied for user 'admin'@'localhost' (using password: YES)

 

이런 오류가 났다. 왜 root가 아닌 존재하지도 않는 admin이란 유저로 설정 됐는지 모르겠어서 이것저것 바꿔보다가 결국 admin 유저를 생성, 후에 그걸 기반으로 디비를 만들었더니 연결이 됐다.