title: Compilation error - com.mysql.jdbc.Driver cannot be resolved to a variable
body: <p>I am barely familiar with pre-bundled STS. I am trying out JDBC for MySQL in Eclipse/Spring on Fedora 17  </p>
  
  <p>Downloaded the mysql JDBC drivers (mysql-connector-java-5.1.22-bin.jar). Then in the IDE</p>
  
  <ol>
  <li>Created a project and named it JDBC</li>
  <li>Created a folder called 'lib' under the project</li>
  <li>Went to Project > Properties . Selected the Java Build Path, then selected the 'Libraries' tab.  clicked on 'Add Jars' Selected JDBC > lib > mysql---.jar and clicked OK.  This added under the Project Explorer pane a 'Referenced Libraries', under which I see the mysql jar file.</li>
  <li>Wrote the following code under the project</li>
  </ol>
  
  <p>I kind of thought I had done what was needed to compile.  However, I am seeing </p>
  
  <p><code>Class.forName(com.mysql.jdbc.Driver);</code></p>
  
  <p>com.mysql.jdbc.Driver cannot be resolved to a variable</p>
  
  <p>Can you tell me what's wrong here.</p>
  
  <pre><code>    import java.sql.Connection;
      import java.sql.DriverManager;
      import java.sql.PreparedStatement;
      import java.sql.ResultSet;
      import java.sql.SQLException;
      import java.sql.Statement;
  
  
      public class TestJDBC {
  
          /**
           * @param args
           */
          public static void main(String[] args)  throws Exception{
              // TODO Auto-generated method stub
              Connection connection = null;
              Statement statement = null;
              PreparedStatement preparedStatement = null;
              ResultSet resultSet = null;
              try {
                  Class.forName(com.mysql.jdbc.Driver);
                  connection = DriverManager.getConnection("jdbc:mysql://localhost/testdb?" + 
                               "user=myuser&amp;password=mypwd");
                  if (connection != null) {
                      System.out.println ("Connected may be?");
                      connection.close();
                  }
                  else {
                      System.out.println ("Not connected?");
                  }
              }
              catch (Exception e) {
                  connection.close();
              }
          }
      }
  </code></pre>