All the connection string should be continues without any space characters. Make sure you don't have spaces in your string. String connectionString = "jdbc:mysql://localhost/" + dbName + "?user=" + dbUserName + "&password=" + dbPassword + "&useUnicode=true&characterEncoding=UTF-8" your connection string should be some thing like this: dbName = "my_database" Make sure the Fire wall, or Anti virus soft wares don't block MySQL service.Ĭheck your query string. change "wait_timeout" and "interactive_timeout"Īdd these lines to the MySQL config file:.If there is a "skip-networking" line in your MySQL config file, make it comment by adding "#" sign at the beginning of that line. Uncomment "bind-address" attribute or change it to one of the following Ips: Windows: D:\Program Files\mysql\bin\my.ini Point: For the solutions that you need to change the MySQL settings, you can refer to the following not: Here are the solutions that I found on the internet and for each of them, there is at least on person who his problem has been solved with that solution. So I suggest you to try all the solutions one by one and don't give up! Maybe the problem is because of the wrong query string or too many connections to the database. It seems this error can occur generally when there is a problem in connecting to the server. While I was seeking the internet to find the solution for this error, I figured out that there are many solutions that worked for at least one person, but others say that it doesn't work for them! why there are many approaches to this error? I'll try to tell you about different approaches and sum them up here.
#Com mysql jdbc driver code
Finally I changed my code and found out what was the problem. I have tested many approaches that have been mentioned in different web sites, but non of them worked.
#Com mysql jdbc driver driver
The driver has not received any packets from the server. The last packet sent successfully to the server was 0 milliseconds ago. My error was this: .jdbc4.CommunicationsException: Communications link failure Multi-catch parameters are not allowed for source level below 1.I have had the same problem in two of my programs. $n(ThreadPoolExecutor.java:615)Īnd this one with the 1.6: : Unresolved compilation problem:
$AbstractConnectionHandler.process(AbstractProtocol.java:607)
AccessLogValve.invoke(AccessLogValve.java:950) ErrorReportValve.invoke(ErrorReportValve.java:98) AuthenticatorBase.invoke(AuthenticatorBase.java:490) This one when I compile with 1.8 : com/tdk/callbacks/CallBacksListener : Unsupported major.minor version 52.0 (unable to load class ) WebappClassLoader.loadClass(WebappClassLoader.java:1569)Ĭom.(CallBacksListener.java:45) WebappClassLoader.loadClass(WebappClassLoader.java:1688) WebappClassLoader.findClass(WebappClassLoader.java:1208) WebappClassLoader.findClassInternal(WebappClassLoader.java:2948) I have this problem when I deploy my war USING mysql-connector-java-6.0.3.jar on a Apache Tomcat/7.0.52 (Ubuntu) JVM: 1.7.0_79-b14 compiled with JDK 1.7 : com/mysql/jdbc/Driver : Unsupported major.minor version 52.0 (unable to load class )