title: Java program and mySQL connectivity issue: No suitable driver found
body: <p>I've been having a problem with mySQL database connectivity. I'm getting an error:</p>
  
  <blockquote>
    <p>No suitable driver found for jdbc:mysql://127.0.0.1/sakila.</p>
  </blockquote>
  
  <p>I have installed mySQL workbench, and have the driver from here
  <a href="http://dev.mysql.com/downloads/connector/j/" rel="nofollow">http://dev.mysql.com/downloads/connector/j/</a></p>
  
  <p>I have saved mysql-connector-java-5.1.18-bin and set the classpath to </p>
  
  <p>C:\Program Files\Java\jre7\lib\mysql-connector-java-5.1.18-bin;</p>
  
  <p>and started the mysql workbench where the database is found.</p>
  
  <p>The code I am using is as follows: Which I am sure works, as I've asked a friend to test it form me. Unfortunately, we are developing on different platforms and could not instruct me as to how to fix this error. Has anyone an idea on how I can fix this?</p>
  
  <pre><code>public class Version {
  
  public static void main(String[] args) {
  
      Connection con = null;
      Statement st = null;
      ResultSet rs = null;
  
      String url = "jdbc:mysql://127.0.0.1/sakila";
      //String url = "jdbc:mysql://localhost:3306/sakila";
      String user = "root";
      String password = "root";
  
  
      try {
  
  
          con = DriverManager.getConnection(url, user, password);
          st = con.createStatement();
          rs = st.executeQuery("select * from actor;");
  
          System.out.println("test");
  
          if (rs.next()) {
              System.out.println(rs.getString(1));
          }
  
      } catch (Exception ex) {
          System.out.println(ex);
  }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>EDIT: Problem sovled. Did not have .jar appended to the end of the bin file, which is necessary.</p>