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

  • Home
  • SEARCH
  • 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 7853787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:48:09+00:00 2026-06-02T19:48:09+00:00

I have created a Dynamic Web Page project in Eclipse and coded a Servlet.

  • 0

I have created a Dynamic Web Page project in Eclipse and coded a Servlet. I have added derby.jar as a library. When I’m going to deploy the project, I export it as a .war-file and then start Jetty with java -jar start.jar. The servlet works fine without database code. But when I try to use the JavaDB database, the JDBC driver couldn’t be found. How do I use a JavaDB database from my Servlet in Jetty?

I try to use an in-memory-database for testing, and my code looks like this:

protected void doPost(HttpServletRequest request, HttpServletResponse response) 
                         throws ServletException, IOException {

    String sql =    "DECLARE GLOBAL TEMPORARY TABLE SESSION.mytable "+
                    "(id int, message varchar(10)) NOT LOGGED";

    String connURL = "jdbc:derby:memory:memdatabase;create=true";


    try {
        Connection conn = DriverManager.getConnection(connURL);
        PreparedStatement ps = conn.prepareStatement(sql);
        boolean success = ps.execute();
        System.out.println("created: " + success);
    } catch (SQLException e) {
        e.printStackTrace();
    }
}

Here is the Exception that is thrown:

java.sql.SQLException: No suitable driver found for jdbc:derby:memory:memdatabas
e;create=true
        at java.sql.DriverManager.getConnection(Unknown Source)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at com.example.MyJavaServlet.doPost(MyJavaServlet.java:59)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:598
)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java
:486)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.j
ava:119)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.jav
a:499)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandl
er.java:233)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandl
er.java:1065)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:
413)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandle
r.java:192)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandle
r.java:999)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.j
ava:117)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(Cont
extHandlerCollection.java:250)
        at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerColl
ection.java:149)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper
.java:111)
        at org.eclipse.jetty.server.Server.handle(Server.java:350)
        at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(Abstrac
tHttpConnection.java:454)
        at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpC
onnection.java:900)
        at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.conten
t(AbstractHttpConnection.java:954)
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:851)
        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)

        at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnecti
on.java:77)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEn
dPoint.java:606)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEnd
Point.java:46)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPoo
l.java:603)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool
.java:538)
        at java.lang.Thread.run(Unknown Source)
  • 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-06-02T19:48:11+00:00Added an answer on June 2, 2026 at 7:48 pm

    You did not load the driver class before obtaining a connection:

    Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
    Connection conn = ...
    

    Just as a side note, you might also want to refactor the process of loading the driver class and using connections to a single point in your application.

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

Sidebar

Related Questions

I have created simple Java Dynamic Web project in Eclipse. I host my project
I am new in flex.I have created dynamic web project. Run it. It accessible
I have created a dynamic web projects in eclipse which includes jsp pages and
I have created a web page (ASP.NET) that includes a stylesheet to mimic Dynamics
I have basic hello word example of Prime Faces. I have created dynamic web
I have created a project in Dashcode, inserted a List control, enabled a dynamic
I have a dynamically created TextBox in a C#/ASP.NET web page that I want
I am working on Moodle 2.2.1 and have created dynamic.csv files using certain queries.
I have created a dynamic list picker script using Jquery 1.3 and PHP that
I have created a Dynamic Data site against an Entity Framework Model I have

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.