본문 바로가기

Issue

[MySQL][MyBatis] Could not create connection to database server. 오류 해결

반응형

⌗ 오류 현상


2019-10-17 12:47:25.568 ERROR [alarm-api,6f546e3a39df132f,6f546e3a39df132f,false] 29694 --- [http-nio-exec-30] o.a.tomcat.jdbc.pool.ConnectionPool      [o.a.j.l.DirectJDKLog > log:181] : Unable to create initial connections of pool.

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.

⌗ 해결 방법


프로젝트 내 mysql connector jar 파일의 불일치로 발생하는 현상으로,

jar 파일을 더 높은 버전으로 업데이트하거나 maven/gradle을 사용하는 경우 종속성을 업데이트하세요.

 

web.xml/build.gradle 내 컴파일 라이브러리 버전 변경하자 !

 

compile("mysql:mysql-connector-java:5.1.45") ⇢ compile("mysql:mysql-connector-java:6.0.6")

 

 


[참고]

stackoverflow.com/questions/24255601/could-not-create-connection-to-database-server-eclipse-mysql-error

 

Could not create connection to database server - Eclipse MySQL error

can you help me? I already did the jdbc build path and my DB savetime exists. my class: package br.com.savetime; import java.sql.*; public class CriarConexao { private static

stackoverflow.com

mvnrepository.com/artifact/mysql/mysql-connector-java

 

Maven Repository: mysql » mysql-connector-java

JDBC Type 4 driver for MySQL VersionRepositoryUsagesDate8.0.x8.0.21Central5Jul, 20208.0.20Central98Apr, 20208.0.19Central141Dec, 20198.0.18Central145Sep, 20198.0.17Central125Jul, 20198.0.16Central183Apr, 20198.0.15Central185Jan, 20198.0.14Central17Jan, 201

mvnrepository.com

 

반응형

❥ CHATI Github