Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6250635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:27:43+00:00 2026-05-24T13:27:43+00:00

I am trying to develop a web app with eclipse that uses a derby

  • 0

I am trying to develop a web app with eclipse that uses a derby database and runs on tomcat.

My problem is that I cannot start the derby server with eclipse (it works fine out of CMD) and I cannot get my servlet to establish a connection with the database, each time I try I get the error:

java.sql.SQLNonTransientConnectionException: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect.at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.Jieren.servlets.Authenticator.testCredentials(Authenticator.java:84)
at com.Jieren.servlets.Authenticator.doPost(Authenticator.java:36)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

I do not have any xml files that do anything with the connection (I have seen web.xml and such that manage connections) but from what I have seen a connection should be possible via straight java code (which seemed easier to learn with as I am fairly new).

The code that I use to connect with is as follows.

Connection conn = null;
    PreparedStatement prestat = null;
    ResultSet pw = null;

    try {
        Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
    try {
        conn = DriverManager.getConnection("jdbc:derby://localhost:1527/C:/apache-tomcat-7.0.19/Databases/Jieren;" +
                "user=Access;" +
                "password=Entry");

        prestat = conn.prepareStatement("SELECT password FROM logs WHERE username = ?");
        prestat.setString(1, username);
        pw = prestat.executeQuery();
        if (password.equals(pw.toString())) answer = 1;
        pw.close();
        pw = null;
        prestat.close();
        prestat = null;
        conn.close();
        conn = null;

    } catch (SQLException e) {
        e.printStackTrace();
    }
    finally{
        if (pw != null){
            try { pw.close();} catch (SQLException e){;}
            pw = null;
        }
        if (prestat != null){
            try { prestat.close();} catch (SQLException e){;}
            prestat = null;
        }
        if (conn != null){
            try {conn.close();} catch(SQLException e) {;}
        conn = null;
        }
    }

From what I have figured out from looking around, the code should work if everything else is configured correctly. connecting to the database via ij outside eclipse works, so I have a feeling that there is a setting or something that I need to write in eclipse to connect this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T13:27:44+00:00Added an answer on May 24, 2026 at 1:27 pm

    The exception is telling you that your network server is not running. When your connection URL starts jdbc:derby://hostname, then you are telling Derby you wish to run in client-server mode, meaning that your client application will establish a TCP/IP connection to the Network Server. See this doc for how to setup and operate the Network Server: http://db.apache.org/derby/docs/10.8/adminguide/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to develop a web application that mainly uses PHP but i'm using
I'm trying to develop a web app with Django that would let users to
I'm trying to pick a web framework that is Java based to start a
I am trying to develop a web app for iPhone on LBS. I am
I'm trying to develop a web application that dispatch (Dispatcher) to multiple versions of
Im trying to develop my first ASP.NET MVC web app and have run into
I have a Web Application that I'm trying to move from Sun Application Server
I am at the moment trying to develop a web app with Dojo (
I'm trying to use eclipse for Java EE to develop web applications. I need
Web app in progress is here . (corrected URL) I'm trying to develop a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.