java.sql.sqlnontransientconnectionException:java.net.connectException:在端口上连接到服务器本地主机时出错 [英] java.sql.sqlnontransientconnectionexception: java.net.connectException : error connecting to server localhost on port

查看:938
本文介绍了java.sql.sqlnontransientconnectionException:java.net.connectException:在端口上连接到服务器本地主机时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Derbyclient(本地托管的数据库)来研究Java项目.我已经完成了所有工作,除了当我没有手动连接到数据库(从Netbeans)而正在尝试桌面应用程序时,标题中的错误弹出了,我似乎无法解决.感谢您抽出宝贵的时间阅读本文并为我提供帮助.

I've being working on a java project using Derbyclient (database locally hosted). I'm done with everything except that when I'm trying the desktop app while I'm not manually connected to the database (from Netbeans), the error in the title pops up and I can't seem to solve it. Thank you for taking the time to read this and help me.

推荐答案

Derby可以在嵌入式或基于服务器的两种模式下运行.基于服务器的允许多个程序访问同一数据库.嵌入式允许您的应用程序在没有服务器的情况下运行.您的网址选择基于服务器的网址.连接拒绝错误指示服务器未运行.由于服务器是在Netbeans中启动的,因此在Netbeans不运行时将其关闭.

Derby can be run in two modes embedded or server-based. Server-based allows multiple programs to access the same database. Embedded allows your application to run without a server. Your url selects server-based. The connection refused error indicates that the server is not running. Since the server was started within Netbeans it is shutdown when Netbeans is not running.

这些选项是:

  1. 切换到嵌入式.
  2. 使用Netbeans外部的命令启动服务器.
  3. 只需保持Netbeans的运行即可.

要切换到嵌入式,请参阅Apache的文档以获取部署选项: 从网址中删除"//localhost:1527". 另请参见 https://builds.apache.org/job/Derby-docs/lastSuccessfulBuild/artifact/trunk/out/getstart/index.html

To switch to embedded see Apache's documentation for deployment options: Eliminate the "//localhost:1527" from the url. also see the tutorial "Run SQL using the embedded driver" at https://builds.apache.org/job/Derby-docs/lastSuccessfulBuild/artifact/trunk/out/getstart/index.html

要在单独的命令窗口中启动服务器,请参见derbyrun.jar的语法: https://builds.apache.org /job/Derby-docs/lastSuccessfulBuild/artifact/trunk/out/getstart/rgsderbyrunjarsyntax.html

To start the server in a seperate command window see the syntax for derbyrun.jar: https://builds.apache.org/job/Derby-docs/lastSuccessfulBuild/artifact/trunk/out/getstart/rgsderbyrunjarsyntax.html

这篇关于java.sql.sqlnontransientconnectionException:java.net.connectException:在端口上连接到服务器本地主机时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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