0

I've seen many topics with that issue but unfortunately I couldn't solve my problem. I've installed MySQL on my server (CentOS 7), I'm able to connect with my DB via shell or MySQL Workbench but when I'm trying to run my Java app, then I'm getting errors like these:

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.

Caused by: java.net.UnknownHostException: (my server's ip): nodename nor servname provided, or not known

Firewall or proxy can't block connection since I can connect with DB via Workbench or shell.. What's more, I've followed this topic: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure and:

  1. ip address in application.properties is correct
  2. not sure why it could be not recognized
  3. port number is configured to 3306
  4. my DB is running
  5. server accept tcp/ip connections
  6. can't run out of connections since I can connect in same time with Workbench and shell
  7. firewall and proxy is configured to don't block these connections

any ideas what can be wrong with that?

EDIT: My application.properties configuartion

#Database - deployment
spring.datasource.url=jdbc:mysql://xxx.xx.xxx.xxx/mydbname?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Europe/Warsaw
spring.datasource.username=mylogin
spring.datasource.password=mypassword

#Hibernate ddl auto (create, create-drop, validate, update)
spring.jpa.hibernate.ddl-auto=create
spring.jpa.database=mysql
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spazzola
  • 299
  • 1
  • 3
  • 12

0 Answers0