数据源derby - 连接被拒绝 [英] data sources derby - connection refused

查看:1177
本文介绍了数据源derby - 连接被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图连接数据库与java项目。在阅读了一些教程和课程支持后,我了解到我需要在管理控制台下创建一个新的数据源。

I am trying to connect a database with a java project. After reading some tutorials and the course support, I have understood that I need to make a new data source under the Admin Console.

所以,我已经登录到管理控制台,然后导航到Resources - > JDBC - > Data Sources - > New;填充字段,当我测试连接,我得到的错误是这一个:

So, I've logged in into the admin console, then navigated to Resources -> JDBC -> Data Sources -> New; filled in the fields and when I am testing the connection, the error I get is this one:


消息测试连接操作失败的数据源MyDB在
服务器server1在节点RO2CVG6CNode01与以下例外:
java.sql.SQLNonTransientException:java.net.ConnectException:错误
连接到服务器localhost在端口1527与消息连接
refused:connect.DSRA0010E:SQL State = 08001,错误代码= 40,000。
查看JVM日志以获取更多详细信息。

Messages The test connection operation failed for data source MyDB on server server1 at node RO2CVG6CNode01 with the following exception: java.sql.SQLNonTransientException: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect.DSRA0010E: SQL State = 08001, Error Code = 40,000. View JVM logs for further details.

我不知道问题出在哪里。也许与数据库名称:jdbc:derby:D:\MyDB?任何人可以帮助我吗?
本教程之后,我还试图仅使用MyDB >。

但仍然无法正常工作。

I don't know where the problem is. Maybe with the Database name: jdbc:derby:D:\MyDB ? Can anyone help me please? I've also tried to use only MyDB, after this tutorial.
But still it doesn't work.

推荐答案

很有可能您尝试连接到数据库,而实际服务器未在端口1527上运行。

It's quite possible that you are trying to connect to a database without the actual server running on Port 1527.

您可以使用命令行/ linux shell尝试建立连接,具体取决于您使用的操作系统。

You could try establishing a connection using the command line / linux shell - depending on what operating system you are using.

如果您喜欢,请尝试以下操作:

Try this if you like:


  1. 打开命令提示符

  2. 导航到您的Derby安装目录

  3. 到bin目录(注意:进一步浏览到networkServer文件夹(如果存在))

  4. 键入startNetworkServer,然后按Enter键

  1. Open a command prompt
  2. Navigate to your Derby installation directory
  3. Navigate to the "bin" directory(Note:Navigate Further to networkServer folder if it exists)
  4. Type "startNetworkServer" and press Enter

您应该会收到类似这样的消息:

You should get a message that says something like this:

2012-08-29 10:57:16.559 GMT:使用基本服务器安全策略。
2012-08-29 10:57:16.809 GMT:Apache Derby网络服务器 - 10.6.2.1 - (999685)已启动并准备接受端口1527上的连接

2012-08-29 10:57:16.559 GMT : Security manager installed using the Basic server security policy. 2012-08-29 10:57:16.809 GMT : Apache Derby Network Server - 10.6.2.1 - (999685) started and ready to accept connections on port 1527

如果你不这样做,那么也许你可以检查你的防火墙(请在这里发表评论)

If you don't, then maybe you could check your firewall (comments invited here :)

如果你这样做,那么你可以使用下面的方法测试你的连接:

If you do, then you could test your connection using the following method:


  1. 打开另一个命令提示符

  2. 导航到您的Derby安装目录

  3. 导航到bin目录

  4. 键入ij,然后按Enter键



  1. Open another command prompt
  2. Navigate to your Derby installation directory
  3. Navigate to the "bin" directory
  4. Type "ij" and press Enter
  5. Type the following:

 connect 'jdbc:derby://localhost:1527/MyDB';

...并按Enter键

...and press Enter

如果一切正常,您将收到ij>提示。

If all goes well, you will get the "ij>" prompt back.

如果没有,则可能还有其他问题。

If not, then there might be some other problems.

是第一次在derby中创建数据库,那么您将不得不使用它代替上面的步骤5:

If you are creating the database for the first time in derby, then you would have to use this in place of Step 5 above:

     connect 'jdbc:derby://localhost:1527/MyDB;create=true';

...并按Enter

...and press Enter

希望在做这些事情后,你会得到一个连接。在最后一个实例中,您将至少获得一个名为MyDB的新数据库,该数据库在Derby服务器上处于活动状态。如果你的原始数据库(MyDB)相对较小,那么它可能更快,只是重新构建它为任何目的你需要它。

Hopefully after doing these things, you will get a connection. In the last instance, you will at least get a new database called MyDB that is active on the Derby Server. If your original database (MyDB) is relatively small, then it might be quicker just to reconstruct it again for whatever purpose you need it for.

进一步,如果你建立连接,那么您可以尝试其他用于数据库开发的工具,因为至少已消除了连接是问题的可能性。

Further to this, if you do establish a connection, then you could try other tools that you use for database development, since you have at least eliminated the possibility that the connection is the problem.

只是确保检查从步骤4报告的端口号。这通常是1527.如果不是,请在Derby的消息中声明的任何端口更改步骤5中的端口号(或其替换命令为新数据库)。

Just be sure to check the port number that is reported from Step 4. This is usually 1527. If not, then change the port number in Step 5 (or its replacement command for a new database) for whatever port is stated in the message from Derby.

希望这有助于运气:)

Wayne Riesterer

Wayne Riesterer

这篇关于数据源derby - 连接被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆