• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

connection problem  RSS feed

Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here's my code
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.SQLException;

public class Testdb {

public static void main(String[] argv) throws ClassNotFoundException, SQLException {

System.out.println("-------- MySQL JDBC Connection Testing ------------");


System.out.println("MySQL JDBC Driver Registered!");
Connection connection = null;

connection = DriverManager
.getConnection("jdbc:mysql:\\localhost:3306/local MYSQL55","root", "root");

if (connection != null) {
System.out.println("You made it, take control your database now!");
} else {
System.out.println("Failed to make connection!");
-------- MySQL JDBC Connection Testing ------------
MySQL JDBC Driver Registered!
Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:mysql:\localhost:3306/hello
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at Testdb.main(Testdb.java:19)
i have added mysql-connector-java-5.1.22-bin.jar .
but still it is giving me error
Posts: 21745
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Replace the \\ with //.
You're not going crazy. You're going sane in a crazy word. Find comfort in this tiny ad:
how do I do my own kindle-like thing - without amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!