title: Can't find jdbc driver?
body: <p>I've started learning how to connect MySQL database with Java. And since I'm total beginner I was looking for the most basic guide and found <a href="http://alvinalexander.com/java/java-mysql-insert-example-preparedstatement" rel="nofollow">this</a> .
  It looks easy, quite understandable and helpful.</p>
  
  <p>But when i run that code it shows an error and the table is empty.  :(</p>
  
  <p><strong>CODE:</strong></p>
  
  <pre><code>import java.sql.*;
  import java.util.Calendar;
  
  
  
  public class DatabaseClass {
  
  public static void main(String args[]){
      try{
          String myDriver = "org.gjt.mm.mysql.Driver";
          String myUrl = "jdbc:mysql://localhost/test";
          Class.forName(myDriver);
          Connection conn = DriverManager.getConnection(myUrl, "root", "admin");
  
          Calendar calen = Calendar.getInstance();
          java.sql.Date startDate = new java.sql.Date(calen.getTime().getTime());
  
          String query = "insert into users (first_name, last_name, date_created, is_admin, num_points)"
                  + " values(?,?,?,?,?)";
  
          PreparedStatement preparedStmt = conn.prepareStatement(query);
          preparedStmt.setString(1, "Name");
          preparedStmt.setString(2, "LName");
          preparedStmt.setDate(3, startDate);
          preparedStmt.setBoolean(4, false);
          preparedStmt.setInt(5, 5000);
  
          preparedStmt.execute();
  
          conn.close();
  
      }catch(Exception e){
          System.err.println("Got an exception!");
          System.err.println(e.getMessage());
  
      }
  }
  </code></pre>
  
  <p><strong>ERROR:</strong></p>
  
  <pre><code>run:
  Got an exception!
  org.gjt.mm.mysql.Driver
  BUILD SUCCESSFUL (total time: 0 seconds)
  </code></pre>
  
  <p>Same thing happens with any driver I put in.</p>
  
  <p>It's probably my lack of knowledge and it could be not much of a problem, but when you are new to it it looks like first world's problem D:</p>
  
  <p><strong>STACK TRACE:</strong></p>
  
  <pre><code>java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
  at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
  at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
  at java.lang.Class.forName0(Native Method)
  at java.lang.Class.forName(Class.java:191)
  at Sranje.DatabaseClass.main(DatabaseClass.java:14)
  </code></pre>
  
  <hr>
  
  <ul>
  <li>Got Database called 'test'</li>
  <li>In test there is table called 'users' (with specified fields)</li>
  <li>Using MySQL 5.6 Command Line client</li>
  <li>Code built in NetBeans 8.0.2</li>
  </ul>