wood burning stoves 2.0*
The moose likes JDBC and the fly likes No suitable driver found for jdbc:mysql:3306//localhost/test Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "No suitable driver found for jdbc:mysql:3306//localhost/test" Watch "No suitable driver found for jdbc:mysql:3306//localhost/test" New topic

No suitable driver found for jdbc:mysql:3306//localhost/test

Joe McTigue
Ranch Hand

Joined: Mar 05, 2012
Posts: 52
HI, I'm working on a windows 7 laptop in an Eclipse Juno IDE writing a simple Java SE 7 Swing application to learn how to connect to my 5.5 MySQL database using a Connector/j driver.
I seem to be having trouble with java finding the Connector/j Driver.
I'm getting the following error message: "No suitable driver found for jdbc:mysql:3306//localhost/test".
I've made sure the mysql-connector-java-5.1.22-bin.jar file is in the classpath on my laptop as well as in the Eclipse IDE, but I still have this error.
Could you point me in the right dirrection?
Keep in mind this not for a webserver, just a stand alone Java swing application.
Here's a sample of my connection code:

Any advice at this point would be greatly appreciated.
Nam Ha Minh
Ranch Hand

Joined: Oct 31, 2011
Posts: 498

The database URL is incorrect:

It should be:

See detailed explanation here.

PM Me If You Want to get Urgent Help on Java Programming
Joe McTigue
Ranch Hand

Joined: Mar 05, 2012
Posts: 52
Hi Nam Ha Minh, This doesn't seem to help, sorry... but thanks for the effort.
--> "No suitable driver found for jdbc:mysql:3306//test"

Sorry, I miss read your post, trying again with you correction offered:
--> "No suitable driver found for jdbc:mysql//localhost:3306/test"

Is there any known bug in using the binary Connector/j 5.1.22 driver with a Java 7 version JDK?
Waldemar Macijewski
Ranch Hand

Joined: Jun 22, 2012
Posts: 32
In Eclipse, you can add various libraries to your project in Build Path panel. In Package explorer right click on your project's name, Buildpath->Configure Build Path->Libraries->Add external jars. Point this to driver's .jar file.
Joe McTigue
Ranch Hand

Joined: Mar 05, 2012
Posts: 52
Hi Mark, thanks for the advice, but already did this using eclipse and still getting the same error. :-(

Here's what I've done so far:
1.) installed java SDK 7
2.) installed Connector/j 5.1
3.) installed Eclipse Juno IDE
4.) installed TextPad IDE //to eliminate issue being with Eclipse
5.) added Connector/j to laptop classpath: C:\java mysql driver\mysql-connector-java-5.1.22-bin.jar
6.) Configured Eclipse with application build classpath for external jar to include connector/j driver
7.) wrote a simple java application to test the JDK // worked
8.) wrote test application to connect to mysql using Connector/j. //see connection notes above.
9.) My platform is a windows 7 laptop
10.) tested eclipse java application // "No suitable driver found for jdbc:mysql://localhost:3306/test"
11.) copied same application from Eclipse and saved in Textpad and saved, then ran the following against those java files
from the commandline in windows 7:
javac RetrieveData.java Testing.java OcaSe7ProgrammerStudyTest.java
java -cp mysql-connector-java-5.1.22-bin.jar;. OcaSe7ProgrammerStudyTest //having main in this class
results: "No suitable driver found for jdbc:mysql://localhost:3306/test"

Keep in mind: This appication is a stand alone Swing application, Not using any web servers for this.
Any help or advice on getting the JDBC Driver working would be greatly appreciated.

Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

Items (5) and (10) seem to indicate that you think that Eclipse projects use the classpath you set as a system property. But they don't. Each Eclipse project has its own "build path". Right-click on the project and you'll find an option to configure the build path.
It is sorta covered in the JavaRanch Style Guide.
subject: No suitable driver found for jdbc:mysql:3306//localhost/test
Similar Threads
JDBC, mysql connector/j, face a problem to connect mysql 5.1 and JSE.
No suitable driver found
sql exception thrown
problem to insert data - mysql
Class.forname() and Access