java.sql.SQLException: Communication link failure: null
Vikas
Ranch Hand
Joined: Dec 16, 2004
Posts: 63
posted
0
Hi all,
I am trying to connect to the MySQL database but am getting the following unusual exception can anybody help me in this regards??
java.sql.SQLException: Communication link failure: null at org.gjt.mm.mysql.MysqlIO.init(MysqlIO.java:261) at org.gjt.mm.mysql.Connection.(Connection.java:229) at org.gjt.mm.mysql.Driver.connect(Driver.java:126) at java.sql.DriverManager.getConnection(DriverManager.java:515) at java.sql.DriverManager.getConnection(DriverManager.java:174) at org.apache.jsp.test$jsp._jspService(test$jsp.java:70) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106) at java.lang.Thread.run(Thread.java:579)
Vikas, It looks like mySql might be down or there is an error connecting. First check you can access mySql from the command line. Also, if it the database is on a different machine, check the ports are open.
I usually give the same advice for problems like this: it's easier to download SquirrelSQL and debug your JDBC connection here and then move the settings to your application. This way you don't have to keep compiling.
Vikas
Ranch Hand
Joined: Dec 16, 2004
Posts: 63
posted
0
>> Vikas, >> It looks like mySql might be down or there is an error connecting. First >> check you can access mySql from the command line. Also, if it the >> database is on a different machine, check the ports are open.
Thank you Jeanne and David,
I checked the MySQL accessibilty from the command line which is on the same machine and I can login through the command line I cheked the porta as well with telnet mysql 3306 which displayed a window with some strange message which diappears after a while I think everything is fine with that. Do I need to re-install the MySQL??
Thank you Vikas
Vikas
Ranch Hand
Joined: Dec 16, 2004
Posts: 63
posted
0
Hi,
I tried the same code on different machine with different MySQL server but the result is same "java.sql.SQLException: Communication link failure: null "
what could be wrong with the following piece of code??