java.sql.sqlnontransientconnectionexception: java.net.connectException : error connecting to server localhost on port

前端 未结 1 1345
梦如初夏
梦如初夏 2021-01-27 23:41

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

相关标签:
1条回答
  • 2021-01-28 00:39

    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.

    The options are:

    1. Switch to embedded.
    2. Start the server with a command outside Netbeans.
    3. Just keep Netbeans running.

    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

    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

    0 讨论(0)
提交回复
热议问题