gpt4 book ai didi

java - 如何使用 Eclipse Juno 从管理系统连接 MYSQL 数据库?

转载 作者:行者123 更新时间:2023-11-30 00:42:55 25 4
gpt4 key购买 nike

我尝试在服务器和客户端系统之间创建 Mysql 连接。我的管理系统 IP 地址是(192.168.1.5)。我有一个数据库“测试”。我下载了 mysql-connector-java-5.1.29 并添加了 Java Buildpath。截图如下:

enter image description here

每当我尝试测试连接时,它都会显示这样的错误..

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:通信链路故障

最后一次成功发送到服务器的数据包是在 0 毫秒前。驱动程序尚未收到来自服务器的任何数据包。

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

at java.lang.reflect.Constructor.newInstance(Unknown Source)

at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)

at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1129)

at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:358)

at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2498)

at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2535)

at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2320)

at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:834)

at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

at java.lang.reflect.Constructor.newInstance(Unknown Source)

at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)

at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:416)

at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:347)

at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnection.createConnection(JDBCConnection.java:214)

at org.eclipse.datatools.connectivity.DriverConnectionBase.internalCreateConnection(DriverConnectionBase.java:105)

at org.eclipse.datatools.connectivity.DriverConnectionBase.open(DriverConnectionBase.java:54)

at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnection.open(JDBCConnection.java:73)

at org.eclipse.datatools.enablement.internal.mysql.connection.JDBCMySQLConnectionFactory.createConnection(JDBCMySQLConnectionFactory.java:28)

at org.eclipse.datatools.connectivity.internal.ConnectionFactoryProvider.createConnection(ConnectionFactoryProvider.java:83)

at org.eclipse.datatools.connectivity.internal.ConnectionProfile.createConnection(ConnectionProfile.java:359)

at org.eclipse.datatools.connectivity.ui.PingJob.createTestConnection(PingJob.java:76)

at org.eclipse.datatools.connectivity.ui.PingJob.run(PingJob.java:59)

at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

原因:java.net.ConnectException:连接超时:连接

at java.net.DualStackPlainSocketImpl.connect0(Native Method)

at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)

at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)

at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)

at java.net.AbstractPlainSocketImpl.connect(Unknown Source)

at java.net.PlainSocketImpl.connect(Unknown Source)

at java.net.SocksSocketImpl.connect(Unknown Source)

at java.net.Socket.connect(Unknown Source)

at java.net.Socket.connect(Unknown Source)

at java.net.Socket.<init>(Unknown Source)

at java.net.Socket.<init>(Unknown Source)

at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)

at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:308)

... 22 more

我也附上了屏幕截图..

请帮我解决这个问题..提前致谢.. enter image description here

最佳答案

将您的网址更改为:jdbc:mysql://192.168.1.5:3306/并且您的数据库名称为 atrics 而不是 test。HTH。查看http://itsolutionsforall.com/eclipse_sql.php

关于java - 如何使用 Eclipse Juno 从管理系统连接 MYSQL 数据库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21625994/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com