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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:08:08+00:00 2026-05-14T21:08:08+00:00

I’ve been trying to obtain the Driver class for JDBC connection to MySQL. The

  • 0

I’ve been trying to obtain the Driver class for JDBC connection to MySQL.
The workstation is running on Linux, Fedora 10.
I have manually set up the classpath variable for Java by CLI like this:

bash-3.2$ echo $CLASSPATH
/home/cmao/public_html/jsp/mysql-connector-java-5.1.12-bin.jar

This shows that I’ve added the lastest mysql connection jar archive to my CLASSPATH variable.

I’ve created a test JSP page which can be found here

And source code for this page is:

<%@page language="java"%>
<%@page import="java.sql.*"%>
<%@page import="java.util.*"%>
<html>
<head>
    <title>UTS JDBC MySQL connection test page</title>
</head>
<body>
<%
    Connection con = null;
    out.print("Java version is   : " + System.getProperty("java.version") + "<br />");
    out.print("Tomcat version is : " + application.getServerInfo() + "<br />");
    out.print("Servlet version is: " + application.getMajorVersion() + "<br />"); 
    out.print("JSP version is    : " + JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion() +"<br />");
    //out.print("Java classpath is : " + System.getProperty("java.class.path")+ "<br />");
    //out.print("JSP classpath is  : " + appliaction.getAttribute("org.apache.catalina.jsp_classpath") + "<br />");
    //out.print("Tomcat classpath is : " + System.getProperty("org.apache.tomcat.common.classpath") + "<br />");

    try
    {
        Class c = Class.forName("com.mysql.jdbc.Driver");
    }
    catch(Exception e)
    {
        out.println("Error! Failed to obtain JDBC driver for MySQL... Missing class \"com.mysql.jdbc.Driver\"<br />");
    }
%>
</body>
</html>

None of those commented out line would work, various Jsper Expetions would be thrown.

You can check those Error pages from the following links:
classpath Error page
catalina Error page
tomcat Error page

It seems, from my limited knowledge of JSP and Servlet, the Tomcat environment “ignores” my Java CLASSPATH? In which case I cannot configure the MySQL JDBC package to let my Servlets(a JSP is but a Servlet anyway) work.

I am not sure how to fix this issue. would it be better if I use an IDE like Eclipse or NetBeans and create a real Java “web app” so that everything can be “self-configured” by the usage of a web.config XML configuration file? So that I can certainly bypass this Tomcat environment restriction?

Many thanks for the suggestions in advance.

  • 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-14T21:08:08+00:00Added an answer on May 14, 2026 at 9:08 pm

    This shows that I’ve added the lastest
    mysql connection jar archive to my
    CLASSPATH variable.

    Too bad for you that Tomcat (and all other Java EE app servers) ignore any system CLASSPATH environment variable.

    You are supposed to add JDBC driver JARs in either one of two places:

    1. WEB-INF/lib for your web context,
      which means it’s available ONLY to
      your app (might not be a bad thing)
    2. In the Tomcat server/lib if you’re using version 5.x or /lib if you’re using version 6.x.

    I believe that Tomcat 6.x requires that you put JDBC driver JARs in /lib.

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I am trying to loop through a bunch of documents I have to put
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I am doing a simple coin flipping experiment for class that involves flipping 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.