English 中文(简体)
通信链接故障
原标题:Communications links failure

I m使用MacBook Pro, 安装在MMP上。 在MAMP方面,一切都在做罚款。 此外,JDBC连接器也位于该地。

问题在于,当我试图通过我的java法典与我的SQL联系时,我会发出以下错误信息:

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:348)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2391)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2428)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2213)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:797)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:389)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at DatabaseConnection.<init>(DatabaseConnection.java:22)
at Main.main(Main.java:10)
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at java.net.Socket.<init>(Socket.java:375)
at java.net.Socket.<init>(Socket.java:218)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:257)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:298)
... 16 more

这里是我在 Java法典中的联系声明(我也检查了全权证书):

connection = DriverManager.getConnection("jdbc:mysql:///"+databaseName, userName, password);

这完全导致我cra笑,因为用同样的装置和手法,所有东西都行得当。

因此,我的MacBook Pro认为,不让我通过 Java与我的SQL联系是错误的吗?

问题回答

You ll have to do some diagnostics on the MacBook first.
Because the driver is not receiving any packets...
That means there s no connectivity.

• 开放一个终端窗口,并做到:

su
--> enter password
mysql
--> does mysql start?
telnet localhost 3306
--> do you get a response?
ps -ef |grep mysql
--> do you see a mysql instance?
less /etc/my.cnf
--> check out the settings, what port number is used?

MAMP、我的sql JLinkor、Java和“通信链接故障”例外的解决方案,最好通过安装一个品牌新版的我的服务器来解决。

我认为,由于我sql的MAMP版本,TCP/IP港已经关闭。 你们可以采取以下步骤来做到这一点。 然而,我发现,这些步骤都没有为我工作,因此,通过安装停机安装有网络链接的神秘面像服务器的品牌新复印件非常容易。

你们可以尝试为MAMP的我sql提供网络接入,并采取以下步骤。 发射“MAMP Pro”(这些功能中无一在自由版本中)。”

a 。 “File”->“Edit Template”->”MySQL my.cnf”,并编辑以下两条。 注意不改变任何其他东西。

bind-address = 0.0.0.0
#MAMP_skip-networking_MAMP    

b) Uncheck the “Allow local access only” on the "Server” tab.

在你采取这些步骤确认TCP/IP的使用:

净状况——tln Schilling

“MAMP”和“uncheck”仅允许当地进入。 简单明了:D





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签