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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:20:09+00:00 2026-06-14T13:20:09+00:00

I use the programs: eclipse and mysql. I have a database in mysql and

  • 0

I use the programs: eclipse and mysql.

I have a database in mysql and I want to connect between the eclipse to the mysql.

I have some folders in my project that I created in the eclipse.

I have the main folder: testest.. and I show you what I have in the relevant folders:

testest
..src
....testest
......testestservlet.java
..app engine sdk
..JRE system library
..referenced library
..war
..lib
....mysql-connector-java-5.1.22

I updated my testestservlet.java:

package testest;

import java.io.IOException;
import javax.servlet.http.*;
import java.sql.*;

@SuppressWarnings("serial")
public class TestestServlet extends HttpServlet {
  public void doGet(HttpServletRequest req, HttpServletResponse resp)
        throws IOException {
      resp.setContentType("text/plain");
      resp.getWriter().println("Hey, world");
      resp.getWriter().println("MySQL Connect Example.");
      Connection conn = null;
      String url = "jdbc:mysql://localhost:3306/";
      String dbName = "database_alon";
      String driver = "com.mysql.jdbc.Driver";
      String userName = "root"; 
      String password = "ADMINALON";
      try {
          Class.forName(driver).newInstance();
          conn = DriverManager.getConnection(url+dbName,userName,password);
          resp.getWriter().println("Connected to the database");
          conn.close();
          resp.getWriter().println("Disconnected from database");
      } catch (Exception e) {
          e.printStackTrace(); 
      }
  }
}

now, I run testest by run as->web application.

enter the url: localhost:8888

and only see the ‘hello world’.

I read about that and see that I need to write the command:

set CLASSPATH=%CLASSPATH%;JAVA_HOME\lib;

but what are the url-s of my CLASSPATH and JAVA_HOME should be? I have folders of: c:/program_fils/java
and: c:/Jconnector (something like that).

the folder of Jconnector contains a file of: mysql-connector-java-5.1.22.jar

I tried to add the JAR into the libraries via the eclipse (right click on testest->properties->Libraries->add external jar->mysql-connector-java-5.1.22-bin.jar:

enter image description here

p.s, my operating system is windows 32bit.

  • 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-14T13:20:10+00:00Added an answer on June 14, 2026 at 1:20 pm

    There is no need of doing

    set CLASSPATH=%CLASSPATH%;JAVA_HOME\lib;
    

    Just add mysql-connector-java-5.1.22-bin.jar: to /WEB-INF/lib directory.

    Eclipse is smart enough to recognize .jar files added under /WEB-INF/lib and should include in the CLASSPATH.

    Adding a library using “Add External Jar” should also work but its not best practice.

    Dropping “.jar” inside /WEB-INF/lib will also work when you externally deploy your web apllication using .war

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

Sidebar

Related Questions

I have several somewhat separate programs, that conceptually can fit into a single project.
I want to connect to a MySQL database from a c++ program. I've installed
So I usually run my programs through Eclipse but I'm not allowed to use
I currently make Java (eclipse) applications for PC use. Everything from basic standalone programs,
The language shootout benchmarks at http://benchmarksgame.alioth.debian.org/ indicate that FPC programs use about 1/50th of
I've got several programs that use shared libraries. Those shared libraries in turn use
I'm having a problem when running programs that use Java from the command line.
When I use Eclipse to code Java programs, I can fold a block of
I'd like to create python programs that use mpi4py and thus I'd like to
I want to use Eclipse to develop C++ projects on Linux. Particularly I want

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.