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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:30:02+00:00 2026-06-11T01:30:02+00:00

I am having issues trying to get a database connection using the code below:

  • 0

I am having issues trying to get a database connection using the code below:

import java.lang.*;
import java.sql.*;

public class Demo {
    public static void main(String[] args){
        try{
            Connection conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/test?" + "user=test&password=123456");
        }catch(SQLException ex){
            System.out.println("SQLException: " + ex.getMessage());
            System.out.println("SQLState: " + ex.getSQLState());
            System.out.println("VendorError: " + ex.getErrorCode());
        }catch(Exception ex){
            System.out.println("Exception: " + ex.getMessage());
        }
    }                                             
}

The error message that is outputted is:

SQLException: No suitable driver found for jdbc:mysql://127.0.0.1:3306/test?user=test&password=123456
SQLState: 08001
VendorError: 0

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at Demo.main(Demo.java:9)

My java version is below:

java -> /usr/lib/jvm/java-6-openjdk-i386/bin/java
javac -> /usr/lib/jvm/java-6-openjdk-i386/bin/javac
javac.1.gz -> /usr/lib/jvm/java-6-openjdk-i386/man/man1/javac.1.gz
javadoc -> /usr/lib/jvm/java-6-openjdk-i386/bin/javadoc
javadoc.1.gz -> /usr/lib/jvm/java-6-openjdk-i386/man/man1/javadoc.1.gz
javah -> /usr/lib/jvm/java-6-openjdk-i386/bin/javah
javah.1.gz -> /usr/lib/jvm/java-6-openjdk-i386/man/man1/javah.1.gz
javap -> /usr/lib/jvm/java-6-openjdk-i386/bin/javap
javap.1.gz -> /usr/lib/jvm/java-6-openjdk-i386/man/man1/javap.1.gz
javaws -> /usr/lib/jvm/java-6-openjdk-i386/jre/bin/javaws
javaws.1.gz -> /usr/lib/jvm/java-6-openjdk-i386/jre/man/man1/javaws.1.gz

I’ve, literally, no idea how to troubleshoot this error message. The database exists. The username and password exists. I’ve currently not added any tables to the database but I don’t think that can be the issue, since I’m only making a connection after all…

Driver is installed under /usr/share/java

-rw-r--r-- 1 root root   822524 10月 20  2011 mysql-connector-java-5.1.16.jar
-rw-r--r-- 1 root root   827942  9月  9 22:40 mysql-connector-java-5.1.21-bin.jar
lrwxrwxrwx 1 root root       35  9月  9 22:40 mysql-connector-java.jar -> mysql-connector-java-5.1.21-bin.jar
lrwxrwxrwx 1 root root       24 10月 20  2011 mysql.jar -> mysql-connector-java.jar

Does anybody know how to fix it..
Thanks for your help!
🙂

  • 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-11T01:30:03+00:00Added an answer on June 11, 2026 at 1:30 am

    Make sure you have mysql connector driver (i.e. jar file) in your project library. This error message appears when there is no appropriate driver.

    You can download the MySQL connector driver from this site.

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

Sidebar

Related Questions

I am having issues trying to get a database connection using the code below:
I'm creating a database using entity framework code first and I'm having some issues
Im having difficulties trying to get a connection to my sqlserver database. The database
I'm just trying to get started with NDjango but am having issues running a
I'm trying to get the Mailchimp datasource from Springest working, and I'm having issues.
I am trying to get php's namespace technique down but having some issues here:
I'm trying to get started with twitter4r but I'm having some issues: Why I
I'm trying to convert some VB.net code into C# and having issues trying to
I am working with a MySQL Database and having some issues while trying to
I'm having heavy issues trying to connect to my MSSQL 2012 Express database, with

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.