java - MySQL JDBC Inactive Connection Timeout -


i have java (swing) desktop connected godaddy mysql database (online database). till time database offline, not @ problem, exception when try access menu involves database access. also, create static connection object when application start, , never close when application running.

this description of exception, please if can.
thanks :)

com.mysql.jdbc.exceptions.jdbc4.communicationsexception: communications link fai lure

last packet sent server 47 ms ago.

some more stack trace , chained cause

caused by: java.io.eofexception: can not read response server. expected read 4 bytes, read 0 bytes before connection unexpectedly lost.

i assuming on shared hosting. connecting such hosting publicly not advisable. dealing problem seems problem remote sql. there few things can 1. go cpanel or equivalent , navigate remote sql add address 0.0.0.0 allow connections public ip may want connect it. if using vpn aws have manually edit my.cnf or my.ini depending on weather hosted on linux or windows, add

bind-address = 0.0.0.0 

under

[mysqld] 

tag

  1. next need create user can accessed ip root user has permission accessed locally

    grant on yourdatabasename.* user@'%' identified 'yourrootpassword';


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -