title: Springboot mysql + jpa communications link failure
body: <p>I use mysql + jpa at Springboot</p>
  
  <p>when I send first query to my server, then I didn't use my server for approximately 20 seconds. Finally my server throws mysql communication closed error then, I can't connect to my server.</p>
  
  <p>I access to server with react-native app.</p>
  
  <p>here's my error..</p>
  
  <pre><code>com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
  
  The last packet successfully received from the server was 19,879 milliseconds ago.  The last packet sent successfully to the server was 19,879 milliseconds ago.
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_201]
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_201]
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_201]
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_201]
      at com.mysql.jdbc.Util.handleNewInstance(Util.java:409) ~[mysql-connector-java-5.1.13.jar:na]
      at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1118) ~[mysql-connector-java-5.1.13.jar:na]
  </code></pre>
  
  <p>and here's my application.yml file</p>
  
  <pre><code>spring:
    datasource:
      url: jdbc:mysql://connecturl/dbname?useSSL=false&amp;serverTimezone=UTC&amp;autoReconnect=true
      username: root
      password: ******
      driver-class-name: com.mysql.jdbc.Driver
  
      tomcat:
        test-while-idle: true
        time-between-eviction-runs-millis: 15000
        validation-query: SELECT 1
      hikari:
        connection-timeout: 10000000
  
    jpa:
      hibernate:
        ddl-auto: update
        naming:
          physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
      generate-ddl: false
      show-sql: true
      database: mysql
      database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
      properties.hibernate.enable_lazy_load_no_trans: true
  </code></pre>
  
  <p>I found some errors with mysql lost connection. But all that errors occur when no connection to db with 8hours.</p>
  
  <p>*ps my sql db's timeout setting is 28800</p>