728x90
🚫 1차 오류 발생
java.lang.RuntimeException: Driver org.mariadb.jdbc.Driver claims to not accept jdbcUrl, [DATABASE]
at com.zaxxer.hikari.util.DriverDataSource.<init>(DriverDataSource.java:110) ~[HikariCP-4.0.3.jar!/:na]
at com.zaxxer.hikari.pool.PoolBase.initializeDataSource(PoolBase.java:331) ~[HikariCP-4.0.3.jar!/:na]
at com.zaxxer.hikari.pool.PoolBase.<init>(PoolBase.java:114) ~[HikariCP-4.0.3.jar!/:na]
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:108) ~[HikariCP-4.0.3.jar!/:na]
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~[HikariCP-4.0.3.jar!/:na]
at com.p6spy.engine.spy.P6DataSource.getConnection(P6DataSource.java:300) ~[p6spy-3.9.0.jar!/:na]
at org.springframework.jdbc.datasource.DelegatingDataSource.getConnection(DelegatingDataSource.java:99) ~[spring-jdbc-5.3.29.jar!/:5.3.29]
at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) ~[hibernate-core-5.6.15.Final.jar!/:5.6.15.Final]
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:181) ~[hibernate-core-5.6.15.Final.jar!/:5.6.15.Final]
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:68) ~[hibernate-core-5.6.15.Final.jar!/:5.6.15.Final]
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35) ~[hibernate-core-5.6.15.Final.jar!/:5.6.15.Final]
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101) ~[hibernate-core-5.6.15.Final.jar!/:5.6.15.Final]
Driver org.mariadb.jdbc.Driver claims to not accept jdbcUrl, [DATABASE]
📌 실패 시도
- yml에 database-platform 옵션 추가
database-platform: org.hibernate.dialect.MariaDB103Dialect
- yml에 spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation 옵션 추가
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
- yml에 temp.use_jdbc_metadata_defaults 옵션 추가
spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults= false;
- gradle에 mariadb - jdbc version 추가
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client:3.1.2'
- yml에 hikari 설정 *주의 url아님 jdbc-url
spring:
datasource:
hikari:
jdbc-url: {db_url}
username: {db_username}
password: {db_password}
driver-class-name: {db_driver}
📌 1차 오류 해결
- db는 maria사용하지만 jdbc:mysql로 시작함 -> driver-class-name을 mysql로 설정해줌
- database-platform mysql로 변경
driver-class-name: com.mysql.cj.jdbc.Driver
database-platform: org.hibernate.dialect.MySQL8Dialect
🚫 2차 오류 발생
FATAL: Invalid Username specified. Please check the Username and retry connection. The Username should be in <username@hostname> format.
📌 2차 오류 해결
- username@hostname 으로 URL 설정
- @로 하면 오류 -> %40 으로 해야 함
jdbc:mysql://[USERNAME]%40[HOST]:3306/[스키마이름]?[기타설정]
🚫 3차 오류 발생
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
📌 실패 시도
- JDBD연결하는 URL에 useSSL=false 를 추가
url: jdbc:mysql://[USERNAME]%40[HOST]:3306/[스키마]?useSSL=false&[기타설정]
- url 마지막에 & 추가
url: jdbc:mysql://[USERNAME]%40[HOST]:3306/[스키마]?[기타설정]&
- gradle에 jdbc 의존성 추가
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
- yml 띄어쓰기 확인
- spring.jpa.database=mysql 설정
- url에 amp;autoReconnection=true 추가
url: jdbc:mysql://[USERNAME]%40[HOST]:3306/[스키마]?[기타설정]&autoReconnection=true
⭕ 해결
url: jdbc:mysql://~~~~
마리아 디비를 사용하는데 프로토콜 mysql
mariadb 로 변경
-> url 문제
'Back-End > Issues' 카테고리의 다른 글
[GitHub Actions] Directory ~ does not contain a Gradle build (0) | 2023.09.12 |
---|---|
[Jenkins] git과 연동 오류 (0) | 2023.08.10 |
[Querydsl] gradle 설정 오류 (0) | 2022.10.25 |
[Docker] 포트 충돌 (0) | 2022.10.20 |
[MySQL Error] Fied 'id' doesn't have a default value (0) | 2022.10.19 |