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 7675609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:59:59+00:00 2026-05-31T16:59:59+00:00

Can someone please please explain to me why the following code works when I

  • 0

Can someone please please explain to me why the following code works when I run the app in the Eclipse IDE, but it generates an exception when compiled and run on a server?
I just don’t get it….

public class Database {
    Connection conn = null;
    Statement stmt = null;
    ResultSet rs = null;

    public Database() throws SQLException {
    String host = "localhost:3306";
    String schema = "stickmanDatabase";
    String user = "richard";
    String password = "xxxxxxxx";
    String url = "jdbc:mysql://" + host + "/" + schema + "?user=" + user + "&password=" + password;

    try {
        conn = DriverManager.getConnection(url);
    } catch (SQLException e) {
        e.printStackTrace();
        throw e;
    }
}
}

Here’s the stacktrace I’m getting:

java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/stickmanDatabase?user=richard&password=xxxxxxxx
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at stickmanPyramidScheme.server.Database.<init>(Database.java:23)
    at stickmanPyramidScheme.server.LoginVerification.verifyLogin(LoginVerification.java:10)
    at stickmanPyramidScheme.server.StickmanServer.parseAndExecute(StickmanServer.java:55)
    at stickmanPyramidScheme.server.StickmanServer.main(StickmanServer.java:32)

My understanding is that the problem is that I need the file “mysql-connector-java-5.1.18-bin.jar in the build path, which I do. And if I remove it the code no longer works when running within Eclipse.

Any help would be greatly appreciated. Thanks.

…

Per Andrew’s request… I am using Eclipse, on an Ubuntu Linux server.
I can see that “mysql-connector-java-5.1.18-bin.jar” contains “com.mysql.jdbc” which contains the “Driver.class”
The jar is added to the (application directory)/WEB-INF/lib directory. And still getting the same error.

  • 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-31T16:59:59+00:00Added an answer on May 31, 2026 at 4:59 pm

    I figured out the problem…
    I was under the impression that Eclipse was to take care of getting all the files together, but I needed to add the classpath in the Manifest. Putting it in the manifest worked, but adding a -classpath option nor adding it to my PATHs did not.

    Anyone with a similar problem should note that you need to add this to the MANIFEST.MF in the jar that Eclipse creates:

    Class-Path: /path/file.jar
    

    With blank line at the end of the file

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

Sidebar

Related Questions

Can someone please explain why the following code causes my app to bomb? NSData
Can someone please explain to me why the following code doesn't draw anything, but
Can someone please explain me the following code snippet? value struct ValueStruct { int
Can someone please explain this to me? I have the following code: <form action=<?php
Can someone please explain the following code? Source: Arrays.class, public static <T> void sort(T[]
I am learning javascript and can someone please explain the following code snippet for
Can someone please explain what does the following line of code exactly do? If
Can someone please explain the following Argument Exception : The structure must not be
Can someone please explain to me why in the following code I get an
Can someone please explain the following How was the first JDK release unit Tested?

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.