Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: No suitable driver found for jdbc:mysql://localhost/books

  1. #1
    Junior Member
    Join Date
    Feb 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default No suitable driver found for jdbc:mysql://localhost/books

    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.ResultSetMetaData;
    import java.sql.SQLException;

    public class DisplayAuthors
    {
    // database URL
    static final String DATABASE_URL = "jdbc:mysql://localhost/books";

    // I have the connector at C:\mysql-connector-java-5.1.18... I am not sure whats going on ? Please help


  2. #2
    Member
    Join Date
    Feb 2012
    Posts
    58
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default Re: No suitable driver found for jdbc:mysql://localhost/books

    You have to declare the driver class name for MySQL, for example:

    Class.forName("com.mysql.jdbc.Driver");

Similar Threads

  1. Remaining compile errors: no suitable method found for & cannot find symbol
    By ChuckLep in forum What's Wrong With My Code?
    Replies: 4
    Last Post: December 12th, 2011, 03:33 PM
  2. JDBC Problem - com.mysql.jdbc.Driver
    By icu222much in forum Java Servlet
    Replies: 2
    Last Post: November 21st, 2011, 11:54 PM
  3. No suitable driver found
    By Josheh in forum JDBC & Databases
    Replies: 2
    Last Post: October 16th, 2011, 01:12 AM
  4. java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    By i4ba1 in forum JDBC & Databases
    Replies: 2
    Last Post: August 23rd, 2011, 12:41 PM
  5. Mysql url pointer to server instead of localhost
    By kurt-hardy in forum JDBC & Databases
    Replies: 3
    Last Post: April 12th, 2011, 04:32 AM