Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 530
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The database URL is incorrect:



It should be:



See detailed explanation here.
 
Joe McTigue
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.


 
Marshal
Posts: 28271
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Slime does not pay. Always keep your tiny ad dry.
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic