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

  • Home
  • SEARCH
  • 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 6813427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:34:08+00:00 2026-05-26T20:34:08+00:00

Using Java, I get this error when attempting to connect to a mysql database:

  • 0

Using Java, I get this error when attempting to connect to a mysql database:

java.sql.SQLException: No suitable driver found for 
jdbc:mysql://localhost:3306/mysql at
java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at MyTest1.main(MyTest1.java:28)

I’m using the mysql-connector-java-5.1.18-bin.jar driver. It is in my build path. I have restarted MySQL. I’ve also logged on from the command line with root and no password and it connected fine. I’m not currently seeing a port 3306 in netstat. Previously I was getting a different error (I didn’t change the code). The error was “jdbc mysql Access denied for user ‘root’@’localhost password NO”

try {
    Class.forName("com.mysql.jdbc.Driver");
} 
catch (ClassNotFoundException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} 


try {
    String url = "jdbc:mysql://localhost:3306/mysql";
    Connection con = DriverManager.getConnection(url, "root", "");
}
catch (Exception e){
    e.printStackTrace();
}
  • 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-26T20:34:08+00:00Added an answer on May 26, 2026 at 8:34 pm

    In this particular case (assuming that the Class#forName() didn’t throw an exception; your code is namely continuing with running instead of throwing the exception), this SQLException means that Driver#acceptsURL() has returned false for any of the loaded drivers.

    And indeed, your JDBC URL is wrong:

    String url = "'jdbc:mysql://localhost:3306/mysql";
    

    Remove the singlequote:

    String url = "jdbc:mysql://localhost:3306/mysql";
    

    See also:

    • Mini tutorial on MySQL + JDBC connectivity
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When trying to connect to mysql I always get this error: java.sql.SQLException: No suitable
I am trying to connect to a MySQL database using Java. I want to
I am following this tutorial, I'm using netbeans 6.5.1 http://www.netbeans.org/kb/docs/java/gui-db-custom.html When I get to
In attempting to implement fileUpload using the streaming API I get an error described
I get this error: java.lang.InternalError: name is too long to represent at java.lang.ClassLoader.defineClass1(Native Method)
How to get money from users phone using Java application? So I want to
I get the following warning when using java.net.URLEncoder.encode : warning: [deprecation] encode(java.lang.String) in java.net.URLEncoder
I'm still trying to get my head around using Java's generics. I have no
When using Eclipse or NetBeans IDE on a Java project I get to see
I am aware of using jconsole to attach to a java process to get

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.