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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:38:14+00:00 2026-05-30T15:38:14+00:00

I want to connect to my mySQL db with a java program.Im getting a

  • 0

I want to connect to my mySQL db with a java program.Im getting a ClassNotFoundException . I copied the mysql-connector-java-5.1.18-bin.jar file to the java lib folder and set classpath in user variables to the java/lib folder. i used the following statements to establish the connection:

Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/ammy","system","system");

Error:

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at JDBCEx.main(JDBCEx.java:11)

This is what i get when i try to extract the jar file:

C:\Program Files\Java\jdk1.6.0_16\lib\mysql-connector-java-5.1.18-bin;.
Access is denied
  • 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-30T15:38:15+00:00Added an answer on May 30, 2026 at 3:38 pm

    Go to the user variable classpath option, then edit it and add
    java/lib/mysql-connector-java-5.1.18-bin.jar to the classpath to make your work done

    or download the ConnectorJ driver from the link

    http://www.mysql.com/downloads/connector/j/
    

    and then add that to your classpath. I am using this and it works fine.

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

Sidebar

Related Questions

Briefly, I want to connect remote MYSQL firewalled database to my C# program I
I want to connect a mysql database with eclipse, i have the java developers
I want to connect my java web application with the mysql database but whenever
I am trying to connect to a MySQL database using Java. I want to
I've got a PHP command line program running. And I want to connect to
I'm using JSP and I want to connect to a local mySQL database thorough
I want to connect to MySQL from SBCL using CLSQL. I loaded CLSQL using
I want to connect to a MySQL database that is installed on a linux
I'm creating a new C# project. I want to connect it with the MySQL
I am having trouble getting my entity beans to connect correctly to MySQL. Here's

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.