MYSQL& SQuirreL - 尝试打开SQL连接时发生意外错误

时间:2016-01-19 02:38:12

标签: java mysql sql jdbc

我尝试使用JDBC MySQL驱动程序进行连接,但它无法正常工作。就我而言,我已经正确地执行了每一步,并且MySQL驱动程序具有蓝色复选标记。我正在使用Windows 7.这是我得到错误的堆栈跟踪:

  

java.util.concurrent.ExecutionException:java.lang.RuntimeException:   com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:   通信链路故障

     

成功发送到服务器的最后一个数据包是0毫秒   前。驱动程序未收到来自服务器的任何数据包。在   java.util.concurrent.FutureTask.report(FutureTask.java:122)at   java.util.concurrent.FutureTask.get(FutureTask.java:206)at   net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.awaitConnection(OpenConnectionCommand.java:132)     在   net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.access $ 100(OpenConnectionCommand.java:45)     在   net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand $ 2.run(OpenConnectionCommand.java:115)     在   java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511)     在java.util.concurrent.FutureTask.run(FutureTask.java:266)at   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)     在   java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:617)     在java.lang.Thread.run(Thread.java:745)引起:   了java.lang.RuntimeException:   com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:   通信链路故障

     

成功发送到服务器的最后一个数据包是0毫秒   前。驱动程序未收到来自服务器的任何数据包。在   net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.executeConnect(OpenConnectionCommand.java:171)     在   net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.access $ 000(OpenConnectionCommand.java:45)     在   net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand $ 1.run(OpenConnectionCommand.java:104)     ... 5更多引起:   com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:   通信链路故障

     

成功发送到服务器的最后一个数据包是0毫秒   前。驱动程序未收到来自服务器的任何数据包。在   sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法)     在   sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)     在   sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)     at java.lang.reflect.Constructor.newInstance(Constructor.java:422)     在com.mysql.jdbc.Util.handleNewInstance(Util.java:404)at   com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:981)     在com.mysql.jdbc.MysqlIO。(MysqlIO.java:339)at   com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2253)     在   com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2286)     在   com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2085)     在com.mysql.jdbc.ConnectionImpl。(ConnectionImpl.java:795)at   com.mysql.jdbc.JDBC4Connection。(JDBC4Connection.java:44)at   sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法)     在   sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)     在   sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)     at java.lang.reflect.Constructor.newInstance(Constructor.java:422)     在com.mysql.jdbc.Util.handleNewInstance(Util.java:404)at   com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:400)at at   com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:327)     在   net.sourceforge.squirrel_sql.fw.sql.SQLDriverManager.getConnection(SQLDriverManager.java:133)     在   net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.executeConnect(OpenConnectionCommand.java:167)     ... 7更多引起:java.net.ConnectException:连接定时   出:连接在   java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)at   java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)     在   java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)     在   java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)     在   java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)     在java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)at   java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)at   java.net.Socket.connect(Socket.java:589)at   com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:211)     在com.mysql.jdbc.MysqlIO。(MysqlIO.java:298)... 21更多

1 个答案:

答案 0 :(得分:0)

请检查mysql服务器状态。在堆栈跟踪中,看起来好像使用异步代码,还检查线程是否安全?