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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:12:38+00:00 2026-06-09T23:12:38+00:00

I am running JSP on Tomcat and MySQL through WAMP server. I am unable

  • 0

I am running JSP on Tomcat and MySQL through WAMP server. I am unable to connect the JSP to MySQL. Here is the code

<% 
try {
/* Create string of connection url within specified format with machine name, 
port number and database name. Here machine name id localhost and 
database name is usermaster. */ 
String connectionURL = "jdbc:mysql://localhost:3306/database"; 

// declare a connection by using Connection interface 
Connection connection = null; 

// Load JBBC driver "com.mysql.jdbc.Driver" 
Class.forName("com.mysql.jdbc.Driver").newInstance(); 

/* Create a connection by using getConnection() method that takes parameters of 
string type connection url, user name and password to connect to database. */ 
connection = DriverManager.getConnection(connectionURL, "root", "");

// check weather connection is established or not by isClosed() method 
if(!connection.isClosed())
%>
<% 
out.println("Successfully connected to " + "MySQL server using TCP/IP...");
connection.close();
}
catch(Exception ex){
%>
<%
out.println("Unable to connect to database."+ex.toString());
}
%>

I have even placed mysql-connector-java-5.0.8.jar in /lib folder. Can anyone help me with 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-06-09T23:12:39+00:00Added an answer on June 9, 2026 at 11:12 pm

    Edit: through the discussion, it was determined that the class wasn’t being found, because the server needed to be restarted.

    It would really help if you could tell us what the exception actually is.

    From what you’ve given, it could be a few things:

    • Your jdbc resource isn’t defined in your server.xml (or whatever other places it could be defined)
    • Your connection is coming back null, but you’re invoking a method on it.

    I’ve never accessed resources this way, either. Typically, I use a JNDI lookup with a DataSource from an InitialContext.

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

Sidebar

Related Questions

I have a Tomcat 6.0.24 server running. I'm using to run some JSP pages.
Running Solr on Tomcat 7 on Win 2008 Server. I am looping through a
I have a JSP page running on Tomcat 5.5. I have the following code:
I have a JSP page running in Tomcat that is not rendering properly. Here
I have to display tomcat and mysql running status in jsp page.. If tomcat
I have created a JSP / servlets application running in Tomcat 7. It runs
I am getting this exception while running any JSP on my tomcat5.5 server.Do I
I have a Joomla (nginx + mysql) site running as UI and some JSP
Running my script through Devel::NYTProf showed that the following portion of code took up
I'm trying to get this old JSP project running in Tomcat 7, JRE7 but

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.